diff --git a/client/pony_client.py b/client/pony_client.py index cdc4fba..4ad262c 100644 --- a/client/pony_client.py +++ b/client/pony_client.py @@ -792,22 +792,30 @@ def _upload_file(server_url, fileobj, auth_key): def do(name, commands, context=None, arch=None, stop_if_failure=True): reslist = [] + init_status = True if context: - context.initialize() - - for c in commands: - log_debug('running:', str(c)) - if context: - context.start_command(c) - c.run(context) - if context: - context.end_command(c) - - reslist.append(c.get_results()) + try: + context.initialize() + except: + init_status = False + + if init_status: + for c in commands: + log_debug('running:', str(c)) + if context: + context.start_command(c) + try: + c.run(context) + except: + break + if context: + context.end_command(c) + + reslist.append(c.get_results()) - if stop_if_failure and not c.success(): - break + if stop_if_failure and not c.success(): + break if context: context.finish()