Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Connectivity Check
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Connectivity Check
Commits
1b1648a7
Commit
1b1648a7
authored
5 years ago
by
Marco Malavolti
Browse files
Options
Downloads
Patches
Plain Diff
Moved ECCS-2 into Virtualenv
parent
14d38a88
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+8
-13
8 additions, 13 deletions
README.md
api.py
+30
-7
30 additions, 7 deletions
api.py
logs/eccs2_2020-02-22.log
+3202
-0
3202 additions, 0 deletions
logs/eccs2_2020-02-22.log
with
3240 additions
and
20 deletions
README.md
+
8
−
13
View file @
1b1648a7
# HOWTO Install and Configure ECCS-2
*
`sudo apt install python3-pip chromium chromium-l10n git`
*
`pip3 install certifi selenium urllib3 flask flask-jsonpify flask-restful`
*
`cd /opt ; git clone https://github.com/malavolti/eccs2.git`
*
`cd /opt/eccs2 ; ./eccs2.py`
# Create and configure the ECCS-2 database (not used now)
*
`sudo mysql`
*
`CREATE DATABASE eccs2db;`
*
`CREATE USER 'eccs2user'@'localhost' IDENTIFIED BY '<password>';`
*
`GRANT ALL PRIVILEGES ON eccs2db.* TO 'eccs2user'@'localhost'`
*
`SHOW GRANTS FOR 'eccs2user'@'localhost';`
*
`FLUSH PRIVILEGES;`
*
`sudo apt install python3 python3-pip chromium chromium-l10n git`
*
`python3 -m pip install --user --upgrade pip virtualenv`
*
`python3 -m venv eccs2venv`
*
`source eccs2venv/bin/activate`
(
`deactivate`
di exit Virtualenv)
*
`python3 -m pip install --upgrade wheel setuptools certifi selenium urllib3 flask flask-jsonpify flask-restful`
*
`cd ~ ; git clone https://github.com/malavolti/eccs2.git`
*
`cd eccs2 ; ./eccs2.py`
# API
...
...
@@ -29,4 +24,4 @@
# API Development Server
*
`cd
/opt
/eccs2 ; ./api.py`
*
`cd
~
/eccs2 ; ./api.py`
This diff is collapsed.
Click to expand it.
api.py
+
30
−
7
View file @
1b1648a7
...
...
@@ -9,6 +9,7 @@ import logging
from
logging.handlers
import
RotatingFileHandler
import
re
app
=
Flask
(
__name__
)
api
=
Api
(
app
)
...
...
@@ -39,33 +40,51 @@ def getLogger(filename,log_level="DEBUG",path="./"):
return
logger
# Setup Chromium Webdriver
def
setup
():
chrome_options
=
webdriver
.
ChromeOptions
()
chrome_options
.
add_argument
(
'
--headless
'
)
chrome_options
.
add_argument
(
'
--no-sandbox
'
)
driver
=
webdriver
.
Chrome
(
'
chromedriver
'
,
chrome_options
=
chrome_options
)
# Configure timeouts
driver
.
set_page_load_timeout
(
45
)
driver
.
set_script_timeout
(
45
)
return
driver
# /eccs2/test
class
Test
(
Resource
):
def
get
(
self
):
app
.
logger
.
info
(
"
Test
Superato
!
"
)
app
.
logger
.
info
(
"
Test
Passed
!
"
)
return
{
'
test
'
:
'
It Works!
'
}
class
Checks
(
Resource
):
def
get
(
self
):
app
.
logger
.
info
(
"
R
ichi
est
a
'
Checks
'"
)
app
.
logger
.
info
(
"
R
equ
est
'
Checks
'"
)
file_path
=
"
logs/eccs2checks_2020-02-
19
.log
"
file_path
=
"
logs/eccs2checks_2020-02-
22
.log
"
date
=
PurePath
(
file_path
).
parts
[
-
1
].
split
(
'
_
'
)[
1
].
split
(
'
.
'
)[
0
]
pretty
=
0
status
=
None
idp
=
None
if
'
date
'
in
request
.
args
:
app
.
logger
.
info
(
"
Parametro
'
date
'
inser
ito
"
)
app
.
logger
.
info
(
"
'
date
'
parameter
inser
ted
"
)
file_path
=
"
logs/eccs2checks_
"
+
request
.
args
[
'
date
'
]
+
"
.log
"
date
=
request
.
args
[
'
date
'
]
if
'
pretty
'
in
request
.
args
:
app
.
logger
.
info
(
"
Parametro
'
pretty
'
inser
ito
"
)
app
.
logger
.
info
(
"
'
pretty
'
parameter
inser
ted
"
)
pretty
=
request
.
args
[
'
pretty
'
]
if
'
status
'
in
request
.
args
:
app
.
logger
.
info
(
"
Parametro
'
status
'
inser
ito
"
)
app
.
logger
.
info
(
"
'
status
'
parameter
inser
ted
"
)
status
=
request
.
args
[
'
status
'
]
if
'
idp
'
in
request
.
args
:
app
.
logger
.
info
(
"
Parametro
'
idp
'
inser
ito
"
)
app
.
logger
.
info
(
"
'
idp
'
parameter
inser
ted
"
)
idp
=
request
.
args
[
'
idp
'
]
app
.
logger
.
info
(
idp
)
...
...
@@ -81,6 +100,7 @@ class Checks(Resource):
check_status
=
check
[
2
].
rstrip
(
"
\n\r
"
)
if
(
idp
and
status
):
app
.
logger
.
info
(
"
Checks for
'
idp
'
and
'
status
'
.
"
)
if
(
idp
==
check_idp
and
status
==
check_status
):
result
.
append
(
{
'
sp
'
:
check_sp
,
'
idp
'
:
check_idp
,
...
...
@@ -90,6 +110,7 @@ class Checks(Resource):
elif
(
idp
):
#app.logger.info(re.search(".*."+idp+".*.", check_idp, re.IGNORECASE))
#app.logger.info(check_idp))
app
.
logger
.
info
(
"
Checks for Idp
'
%s
'
.
"
%
idp
)
if
(
re
.
search
(
"
.*.
"
+
idp
+
"
.*.
"
,
check_idp
,
re
.
IGNORECASE
)):
result
.
append
(
{
'
sp
'
:
check_sp
,
'
idp
'
:
check_idp
,
...
...
@@ -97,6 +118,7 @@ class Checks(Resource):
'
date
'
:
date
}
)
elif
(
status
):
app
.
logger
.
info
(
"
Check for the status
'
%s
'
.
"
%
status
)
if
(
status
==
check_status
):
result
.
append
(
{
'
sp
'
:
check_sp
,
'
idp
'
:
check_idp
,
...
...
@@ -104,6 +126,7 @@ class Checks(Resource):
'
date
'
:
date
}
)
else
:
app
.
logger
.
info
(
"
All checks.
"
)
result
.
append
(
{
'
sp
'
:
check_sp
,
'
idp
'
:
check_idp
,
'
status
'
:
check_status
,
...
...
This diff is collapsed.
Click to expand it.
logs/eccs2_2020-02-22.log
0 → 100644
+
3202
−
0
View file @
1b1648a7
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment