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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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):
...
@@ -846,11 +846,14 @@ class Parser(OptionParser):
help
=
"Shall slapformat alter network configuration [default: True]"
),
help
=
"Shall slapformat alter network configuration [default: True]"
),
])
])
def
check_args
(
self
):
def
check_args
(
self
,
args
):
"""
"""
Check arguments
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
:
if
len
(
args
)
!=
1
:
self
.
error
(
"Incorrect number of arguments"
)
self
.
error
(
"Incorrect number of arguments"
)
return
options
,
args
[
0
]
return
options
,
args
[
0
]
...
@@ -1093,7 +1096,7 @@ class Config:
...
@@ -1093,7 +1096,7 @@ class Config:
self
.
computer_xml
=
os
.
path
.
abspath
(
self
.
computer_xml
)
self
.
computer_xml
=
os
.
path
.
abspath
(
self
.
computer_xml
)
def
main
():
def
main
(
*
args
):
"Run default configuration."
"Run default configuration."
global
os
global
os
global
callAndRead
global
callAndRead
...
@@ -1103,7 +1106,7 @@ def main():
...
@@ -1103,7 +1106,7 @@ def main():
try
:
try
:
# Parse arguments
# Parse arguments
options
,
configuration_file_path
=
Parser
(
usage
=
usage
).
check_args
()
options
,
configuration_file_path
=
Parser
(
usage
=
usage
).
check_args
(
args
)
config
=
Config
()
config
=
Config
()
config
.
setConfig
(
options
,
configuration_file_path
)
config
.
setConfig
(
options
,
configuration_file_path
)
os
=
OS
(
config
)
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