Commit 309d4db7 authored by Vincent Pelletier's avatar Vincent Pelletier

Reduce try..except scope.

parent 6e2f0a69
......@@ -859,7 +859,6 @@ class Parser(OptionParser):
return options, args[0]
def run(config):
try:
# Define the computer
if config.input_definition_file:
filepath = os.path.abspath(config.input_definition_file)
......@@ -980,9 +979,6 @@ def run(config):
computer.dump(config.computer_xml)
config.logger.info('Posting information to %r' % config.master_url)
computer.send(config)
except:
config.logger.exception('Uncaught exception:')
raise
class Config:
def checkRequiredBinary(self, binary_list):
......@@ -1104,11 +1100,15 @@ def main(*args):
real_callAndRead = callAndRead
usage = "usage: %s [options] CONFIGURATION_FILE" % sys.argv[0]
try:
# Parse arguments
options, configuration_file_path = Parser(usage=usage).check_args(args)
config = Config()
try:
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)
if config.dry_run:
def dry_callAndRead(argument_list, raise_on_error=True):
......@@ -1136,7 +1136,8 @@ def main(*args):
config.logger.debug(' '.join(argument_list))
return dry_callAndRead(argument_list, raise_on_error)
callAndRead = logging_callAndRead
try:
run(config)
except UsageError, err:
print >>sys.stderr, err.msg
print >>sys.stderr, "For help use --help"
except:
config.logger.exception('Uncaught exception:')
raise
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment