Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
7c3116eb
Commit
7c3116eb
authored
Apr 25, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bring out check_missing_parameters from mammoth
parent
32bd7c06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
27 deletions
+22
-27
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+22
-27
No files found.
slapos/grid/slapgrid.py
View file @
7c3116eb
...
...
@@ -58,12 +58,6 @@ from slapos.grid.utils import (md5digest, createPrivateDirectory, dropPrivileges
setRunning
,
setFinished
,
SlapPopen
,
updateFile
)
import
slapos.slap
MANDATORY_PARAMETER_LIST
=
[
'computer_id'
,
'instance_root'
,
'master_url'
,
'software_root'
,
]
# XXX: should be moved to SLAP library
COMPUTER_PARTITION_DESTROYED_STATE
=
'destroyed'
...
...
@@ -85,6 +79,27 @@ class _formatXMLError(Exception):
pass
def
check_missing_parameters
(
options
):
required
=
set
([
'computer_id'
,
'instance_root'
,
'master_url'
,
'software_root'
,
])
if
'key_file'
in
options
:
required
.
add
(
'certificate_repository_path'
)
required
.
add
(
'cert_file'
)
if
'cert_file'
in
options
:
required
.
add
(
'certificate_repository_path'
)
required
.
add
(
'key_file'
)
missing
=
required
.
difference
(
options
)
if
missing
:
raise
RuntimeError
(
'Missing mandatory parameters: %s'
%
', '
.
join
(
sorted
(
missing
)))
def
parse_arguments_merge_config
(
*
argument_tuple
):
"""Parse arguments and return options dictionary
merged with the config file."""
...
...
@@ -202,10 +217,7 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
setup_logger
(
options
)
missing
=
[]
for
mandatory_parameter
in
MANDATORY_PARAMETER_LIST
:
if
not
mandatory_parameter
in
options
:
missing
.
append
(
mandatory_parameter
)
check_missing_parameters
(
options
)
if
options
.
get
(
'all'
):
options
[
'develop'
]
=
True
...
...
@@ -213,23 +225,6 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
if
options
.
get
(
'maximum_periodicity'
)
is
not
None
:
options
[
'force_periodicity'
]
=
True
repository_required
=
False
if
'key_file'
in
options
:
repository_required
=
True
if
not
'cert_file'
in
options
:
missing
.
append
(
'cert_file'
)
if
'cert_file'
in
options
:
repository_required
=
True
if
not
'key_file'
in
options
:
missing
.
append
(
'key_file'
)
if
repository_required
:
if
'certificate_repository_path'
not
in
options
:
missing
.
append
(
'certificate_repository_path'
)
if
missing
:
raise
RuntimeError
(
'Missing mandatory parameters:
\
n
%s'
%
'
\
n
'
.
join
(
missing
))
key_file
=
options
.
get
(
'key_file'
)
cert_file
=
options
.
get
(
'cert_file'
)
master_ca_file
=
options
.
get
(
'master_ca_file'
)
...
...
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