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
18
Merge Requests
18
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
nexedi
slapos.core
Commits
309d4db7
Commit
309d4db7
authored
Jan 23, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce try..except scope.
parent
6e2f0a69
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
154 additions
and
153 deletions
+154
-153
slapos/format.py
slapos/format.py
+154
-153
No files found.
slapos/format.py
View file @
309d4db7
...
@@ -859,7 +859,6 @@ class Parser(OptionParser):
...
@@ -859,7 +859,6 @@ class Parser(OptionParser):
return
options
,
args
[
0
]
return
options
,
args
[
0
]
def
run
(
config
):
def
run
(
config
):
try
:
# Define the computer
# Define the computer
if
config
.
input_definition_file
:
if
config
.
input_definition_file
:
filepath
=
os
.
path
.
abspath
(
config
.
input_definition_file
)
filepath
=
os
.
path
.
abspath
(
config
.
input_definition_file
)
...
@@ -980,9 +979,6 @@ def run(config):
...
@@ -980,9 +979,6 @@ def run(config):
computer
.
dump
(
config
.
computer_xml
)
computer
.
dump
(
config
.
computer_xml
)
config
.
logger
.
info
(
'Posting information to %r'
%
config
.
master_url
)
config
.
logger
.
info
(
'Posting information to %r'
%
config
.
master_url
)
computer
.
send
(
config
)
computer
.
send
(
config
)
except
:
config
.
logger
.
exception
(
'Uncaught exception:'
)
raise
class
Config
:
class
Config
:
def
checkRequiredBinary
(
self
,
binary_list
):
def
checkRequiredBinary
(
self
,
binary_list
):
...
@@ -1104,11 +1100,15 @@ def main(*args):
...
@@ -1104,11 +1100,15 @@ def main(*args):
real_callAndRead
=
callAndRead
real_callAndRead
=
callAndRead
usage
=
"usage: %s [options] CONFIGURATION_FILE"
%
sys
.
argv
[
0
]
usage
=
"usage: %s [options] CONFIGURATION_FILE"
%
sys
.
argv
[
0
]
try
:
# Parse arguments
# Parse arguments
options
,
configuration_file_path
=
Parser
(
usage
=
usage
).
check_args
(
args
)
options
,
configuration_file_path
=
Parser
(
usage
=
usage
).
check_args
(
args
)
config
=
Config
()
config
=
Config
()
try
:
config
.
setConfig
(
options
,
configuration_file_path
)
config
.
setConfig
(
options
,
configuration_file_path
)
except
UsageError
,
err
:
print
>>
sys
.
stderr
,
err
.
msg
print
>>
sys
.
stderr
,
"For help use --help"
sys
.
exit
(
1
)
os
=
OS
(
config
)
os
=
OS
(
config
)
if
config
.
dry_run
:
if
config
.
dry_run
:
def
dry_callAndRead
(
argument_list
,
raise_on_error
=
True
):
def
dry_callAndRead
(
argument_list
,
raise_on_error
=
True
):
...
@@ -1136,7 +1136,8 @@ def main(*args):
...
@@ -1136,7 +1136,8 @@ def main(*args):
config
.
logger
.
debug
(
' '
.
join
(
argument_list
))
config
.
logger
.
debug
(
' '
.
join
(
argument_list
))
return
dry_callAndRead
(
argument_list
,
raise_on_error
)
return
dry_callAndRead
(
argument_list
,
raise_on_error
)
callAndRead
=
logging_callAndRead
callAndRead
=
logging_callAndRead
try
:
run
(
config
)
run
(
config
)
except
UsageError
,
err
:
except
:
print
>>
sys
.
stderr
,
err
.
msg
config
.
logger
.
exception
(
'Uncaught exception:'
)
print
>>
sys
.
stderr
,
"For help use --help"
raise
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