Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor 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
mediaserver
envsetup
Commits
7e50801e
Commit
7e50801e
authored
8 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
PEP8 cleaning.
parent
903a08e1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_apt_proxy.py
+3
-3
3 additions, 3 deletions
tests/test_apt_proxy.py
tests/test_backup.py
+5
-3
5 additions, 3 deletions
tests/test_backup.py
with
8 additions
and
6 deletions
tests/test_apt_proxy.py
+
3
−
3
View file @
7e50801e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
# Copyright 2017, Florent Thiery
# Copyright 2017, Florent Thiery
'''
'''
Criticality: Normal
Criticality: Normal
Checks that packages mirror works for capture systems
Checks that packages mirror works for capture systems
'''
'''
import
os
import
os
import
sys
import
sys
...
@@ -35,10 +35,10 @@ conf_servers = (
...
@@ -35,10 +35,10 @@ conf_servers = (
for
s
in
conf_servers
:
for
s
in
conf_servers
:
v
=
conf
.
get
(
s
)
v
=
conf
.
get
(
s
)
try
:
try
:
url
=
"
https://%s/old-releases.ubuntu.com/ubuntu/dists/lucid/Release.gpg
"
%
v
url
=
'
https://%s/old-releases.ubuntu.com/ubuntu/dists/lucid/Release.gpg
'
%
v
print
(
'
Checking url certificate %s
'
%
url
)
print
(
'
Checking url certificate %s
'
%
url
)
d
=
requests
.
get
(
url
,
verify
=
False
).
text
d
=
requests
.
get
(
url
,
verify
=
False
).
text
if
not
"
BEGIN PGP SIGNATURE
"
in
d
:
if
'
BEGIN PGP SIGNATURE
'
not
in
d
:
all_ok
=
False
all_ok
=
False
print
(
'
%sUnexpected content: %s%s
'
%
(
RED
,
d
,
DEF
))
print
(
'
%sUnexpected content: %s%s
'
%
(
RED
,
d
,
DEF
))
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_backup.py
+
5
−
3
View file @
7e50801e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
# Copyright 2017, Florent Thiery
# Copyright 2017, Florent Thiery
'''
'''
Criticality: Medium
Criticality: Medium
Checks that the server backups are not older than a day
Checks that the server backups are not older than a day
.
'''
'''
import
os
import
os
import
sys
import
sys
...
@@ -15,7 +15,6 @@ GREEN = '\033[92m'
...
@@ -15,7 +15,6 @@ GREEN = '\033[92m'
RED
=
'
\033
[91m
'
RED
=
'
\033
[91m
'
DEF
=
'
\033
[0m
'
DEF
=
'
\033
[0m
'
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
def
test_ssh
(
ip
):
def
test_ssh
(
ip
):
cmd
=
'
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp
'
%
ip
cmd
=
'
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp
'
%
ip
...
@@ -28,6 +27,7 @@ def test_ssh(ip):
...
@@ -28,6 +27,7 @@ def test_ssh(ip):
return
False
return
False
return
True
return
True
def
test_last_backup_is_recent
(
server
,
client
):
def
test_last_backup_is_recent
(
server
,
client
):
path
=
'
/backup/%s/current
'
%
client
path
=
'
/backup/%s/current
'
%
client
cmd
=
'
ssh -o StrictHostKeyChecking=no %s ls -l %s | grep current
'
%
(
server
,
path
)
cmd
=
'
ssh -o StrictHostKeyChecking=no %s ls -l %s | grep current
'
%
(
server
,
path
)
...
@@ -44,10 +44,12 @@ def test_last_backup_is_recent(server, client):
...
@@ -44,10 +44,12 @@ def test_last_backup_is_recent(server, client):
else
:
else
:
return
False
return
False
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
if
os
.
path
.
isfile
(
'
../utils.py
'
):
if
os
.
path
.
isfile
(
'
../utils.py
'
):
es_utils
=
imp
.
load_source
(
'
es_utils
'
,
'
../utils.py
'
)
es_utils
=
imp
.
load_source
(
'
es_utils
'
,
'
../utils.py
'
)
conf
=
es_utils
.
load_conf
()
conf
=
es_utils
.
load_conf
()
BURP_SERVER
=
conf
.
get
(
'
BURP_SERVER
'
)
BURP_SERVER
=
conf
.
get
(
'
BURP_SERVER
'
)
BURP_CLIENT_NAME
=
conf
.
get
(
'
BURP_CLIENT_NAME
'
,
'
localhost
'
)
BURP_CLIENT_NAME
=
conf
.
get
(
'
BURP_CLIENT_NAME
'
,
'
localhost
'
)
if
BURP_SERVER
:
if
BURP_SERVER
:
if
not
test_ssh
(
BURP_SERVER
):
if
not
test_ssh
(
BURP_SERVER
):
...
...
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