Add documentation for the run() function.

Also: Move the return statement in run() to the bottom
This commit is contained in:
Anders Ingemann 2014-07-09 23:31:16 +02:00
parent 2fb6f344ee
commit cca31b642f

View file

@ -75,7 +75,10 @@ def setup_loggers(opts):
def run(manifest, debug=False, pause_on_error=False, dry_run=False): def run(manifest, debug=False, pause_on_error=False, dry_run=False):
"""Runs the bootstrapping process """Runs the bootstrapping process
:params dict opts: Dictionary of options from the commandline :params Manifest manifest: The manifest to run the bootstrapping process for
:params bool debug: Whether to turn debugging mode on
:params bool pause_on_error: Whether to pause on error, before rollback
:params bool dry_run: Don't actually run the tasks
""" """
# Get the tasklist # Get the tasklist
from tasklist import load_tasks from tasklist import load_tasks
@ -93,7 +96,6 @@ def run(manifest, debug=False, pause_on_error=False, dry_run=False):
tasklist.run(info=bootstrap_info, dry_run=dry_run) tasklist.run(info=bootstrap_info, dry_run=dry_run)
# We're done! :-) # We're done! :-)
log.info('Successfully completed bootstrapping') log.info('Successfully completed bootstrapping')
return bootstrap_info
except (Exception, KeyboardInterrupt) as e: except (Exception, KeyboardInterrupt) as e:
# When an error occurs, log it and begin rollback # When an error occurs, log it and begin rollback
log.exception(e) log.exception(e)
@ -124,3 +126,4 @@ def run(manifest, debug=False, pause_on_error=False, dry_run=False):
rollback_tasklist.run(info=bootstrap_info, dry_run=dry_run) rollback_tasklist.run(info=bootstrap_info, dry_run=dry_run)
log.info('Successfully completed rollback') log.info('Successfully completed rollback')
raise e raise e
return bootstrap_info