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
Ophélie Gagnard
slapos.core
Commits
c71000ed
Commit
c71000ed
authored
Jul 21, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to pass arguments to main method.
It makes testing much easier.
parent
a3361773
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
slapos/format.py
slapos/format.py
+7
-4
No files found.
slapos/format.py
View file @
c71000ed
...
...
@@ -846,11 +846,14 @@ class Parser(OptionParser):
help
=
"Shall slapformat alter network configuration [default: True]"
),
])
def
check_args
(
self
):
def
check_args
(
self
,
args
):
"""
Check arguments
"""
(
options
,
args
)
=
self
.
parse_args
()
if
args
:
(
options
,
args
)
=
self
.
parse_args
(
list
(
args
))
else
:
(
options
,
args
)
=
self
.
parse_args
()
if
len
(
args
)
!=
1
:
self
.
error
(
"Incorrect number of arguments"
)
return
options
,
args
[
0
]
...
...
@@ -1093,7 +1096,7 @@ class Config:
self
.
computer_xml
=
os
.
path
.
abspath
(
self
.
computer_xml
)
def
main
():
def
main
(
*
args
):
"Run default configuration."
global
os
global
callAndRead
...
...
@@ -1103,7 +1106,7 @@ def main():
try
:
# Parse arguments
options
,
configuration_file_path
=
Parser
(
usage
=
usage
).
check_args
()
options
,
configuration_file_path
=
Parser
(
usage
=
usage
).
check_args
(
args
)
config
=
Config
()
config
.
setConfig
(
options
,
configuration_file_path
)
os
=
OS
(
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