Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
slapos.package
Commits
7fc79875
Commit
7fc79875
authored
Aug 27, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to check upload
parent
e5053117
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
3 deletions
+48
-3
slapos-node/slaptest
slapos-node/slaptest
+48
-3
No files found.
slapos-node/slaptest
View file @
7fc79875
...
@@ -46,6 +46,21 @@ formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')
...
@@ -46,6 +46,21 @@ formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')
ch
.
setFormatter
(
formatter
)
ch
.
setFormatter
(
formatter
)
class
Upload
:
def
__init__
(
self
):
self
.
data
=
{
'download-binary-dir-url'
:
'http://www.shacache.org/shadir'
,
'signature_certificate_file'
:
'/etc/slapos-cache/signature.cert'
,
'upload-dir-url'
:
'https://www.shacache.org/shadir'
,
'shadir-cert-file'
:
'/etc/slapos-cache/shacache.cert'
,
'download-cache-url'
:
'https://www.shacache.org/shacache'
,
'upload-cache-url'
:
'https://www.shacache.org/shacache'
,
'shacache-cert-file'
:
'/etc/slapos-cache/shacache.cert'
,
'upload-binary-cache-url'
:
'https://www.shacache.org/shacache'
,
'shacache-key-file'
:
'/etc/slapos-cache/shacache.key'
,
'download-binary-cache-url'
:
'http://www.shacache.org/shacache'
,
'upload-binary-dir-url'
:
'https://www.shacache.org/shadir'
,
'signature_private_key_file'
:
'/etc/slapos-cache/signature.key'
,
'shadir-key-file'
:
'/etc/slapos-cache/shacache.key'
}
class
Parser
(
OptionParser
):
class
Parser
(
OptionParser
):
"""
"""
...
@@ -65,6 +80,10 @@ class Parser(OptionParser):
...
@@ -65,6 +80,10 @@ class Parser(OptionParser):
help
=
"path to slapos cron file"
,
help
=
"path to slapos cron file"
,
default
=
'/etc/cron.d/slapos-node'
,
default
=
'/etc/cron.d/slapos-node'
,
type
=
str
),
type
=
str
),
Option
(
"--check-upload"
,
help
=
"Check if upload parameters are ok (do not check certificates)"
,
default
=
False
,
action
=
"store_true"
),
Option
(
"-n"
,
"--dry-run"
,
Option
(
"-n"
,
"--dry-run"
,
help
=
"Simulate the execution steps"
,
help
=
"Simulate the execution steps"
,
default
=
False
,
default
=
False
,
...
@@ -113,12 +132,15 @@ def slapos_conf_check (config):
...
@@ -113,12 +132,15 @@ def slapos_conf_check (config):
else
:
else
:
logger
.
info
(
"%s parameter:%s is good"
%
(
key
,
files
))
logger
.
info
(
"%s parameter:%s is good"
%
(
key
,
files
))
# Check network cache
check_networkcache
(
config
,
logger
,
configuration_parser
)
def
check_networkcache
(
config
,
logger
,
configuration_parser
):
# Check network cache download
slapos_cfg_example
=
get_slapos_conf_example
()
slapos_cfg_example
=
get_slapos_conf_example
()
configuration_example_parser
=
ConfigParser
.
RawConfigParser
()
configuration_example_parser
=
ConfigParser
.
RawConfigParser
()
configuration_example_parser
.
read
(
slapos_cfg_example
)
configuration_example_parser
.
read
(
slapos_cfg_example
)
os
.
remove
(
slapos_cfg_example
)
os
.
remove
(
slapos_cfg_example
)
section
=
"networkcache"
section
=
"networkcache"
configuration_example_dict
=
dict
(
configuration_example_parser
.
items
(
section
))
configuration_example_dict
=
dict
(
configuration_example_parser
.
items
(
section
))
configuration_dict
=
dict
(
configuration_parser
.
items
(
section
))
configuration_dict
=
dict
(
configuration_parser
.
items
(
section
))
...
@@ -129,7 +151,30 @@ def slapos_conf_check (config):
...
@@ -129,7 +151,30 @@ def slapos_conf_check (config):
except
KeyError
:
except
KeyError
:
logger
.
warn
(
"No %s parameter in your file"
%
key
)
logger
.
warn
(
"No %s parameter in your file"
%
key
)
pass
pass
if
config
.
check_upload
==
True
:
check_networkcache_upload
(
config
,
logger
,
configuration_dict
)
def
check_networkcache_upload
(
config
,
logger
,
configuration_dict
):
# Check network cache upload
upload_parameters
=
Upload
()
for
key
in
upload_parameters
.
data
:
try
:
if
not
key
.
find
(
"file"
)
==
-
1
:
file
=
configuration_dict
[
key
]
if
not
os
.
path
.
exists
(
file
)
:
logger
.
critical
(
"%s file for %s parameters does not exist "
%
(
file
,
key
))
else
:
logger
.
info
(
"%s parameter:%s is good"
%
(
key
,
file
))
else
:
if
not
configuration_dict
[
key
]
==
upload_parameters
.
data
[
key
]:
logger
.
warn
(
"%s is %s sould be %s"
%
(
key
,
configuration_dict
[
key
]
,
upload_parameters
.
data
[
key
]))
except
KeyError
:
logger
.
critical
(
"No %s parameter in your file"
%
key
)
pass
def
slapos_global_check
(
config
):
def
slapos_global_check
(
config
):
# Define logger for register
# Define logger for register
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment