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
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
Gabriel Monnerat
slapos.core
Commits
72000fa8
Commit
72000fa8
authored
Nov 01, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos client: Cleanup + safety checks of Config
parent
59cfcf85
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
slapos/client.py
slapos/client.py
+12
-5
No files found.
slapos/client.py
View file @
72000fa8
...
...
@@ -115,7 +115,7 @@ def check_request_args():
class
Config
:
def
setConfig
(
self
,
option_dict
,
configuration_file_path
):
def
setConfig
(
self
,
option_dict
,
configuration_file_path
=
None
):
"""
Set options given by parameters.
"""
...
...
@@ -125,10 +125,15 @@ class Config:
# Load configuration file
configuration_parser
=
ConfigParser
.
SafeConfigParser
()
if
configuration_file_path
:
configuration_file_path
=
os
.
path
.
expanduser
(
configuration_file_path
)
if
not
os
.
path
.
isfile
(
configuration_file_path
):
raise
OSError
(
'Specified configuration file %s does not exist.'
' Exiting.'
%
configuration_file_path
)
configuration_parser
.
read
(
configuration_file_path
)
# Merges the arguments and configuration
try
:
configuration_dict
=
dict
(
configuration_parser
.
items
(
"slapconsole"
))
configuration_dict
=
dict
(
configuration_parser
.
items
(
'slapconsole'
))
except
ConfigParser
.
NoSectionError
:
pass
else
:
...
...
@@ -184,11 +189,13 @@ def init(config):
return
local
def
request
():
"""Ran when invoking slapos
-request
"""
"""Ran when invoking slapos
request. Request an instance.
"""
# Parse arguments and inititate needed parameters
# XXX-Cedric: usage is different from what is specified in slapos doc.
usage
=
"""usage: %s [options] CONFIGURATION_FILE INSTANCE_REFERENCE SOFTWARE_INSTANCE
slapos-request allows you to request slapos instances."""
%
sys
.
argv
[
0
]
config
=
Config
()
# XXX-Cedric: move argument parsing to main entry point
options
=
check_request_args
()
config
.
setConfig
(
options
,
options
.
configuration_file
)
local
=
init
(
config
)
...
...
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