Skip to content

Commit

Permalink
updated for handling context init failure and command exceptions, asw…
Browse files Browse the repository at this point in the history
…ell as fix for indentation issue
  • Loading branch information
mlaite committed Apr 22, 2010
1 parent 3b3e53d commit 150e3e1
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions client/pony_client.py
Expand Up @@ -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()
Expand Down

0 comments on commit 150e3e1

Please sign in to comment.