Skip to content

Commit

Permalink
Handle exceptions occured during cleanup step
Browse files Browse the repository at this point in the history
We do not want the cleanup step to throw unhandled excpetions and stop
the whole job. Log any errors arising from failed commands at error
level and continue operations.

freeipa#20
  • Loading branch information
Martin Babinsky authored and martbab committed Dec 6, 2016
1 parent 2bf4578 commit a022ef9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ipadocker/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,11 @@ def run_action(ipaconfig, args, action):
logger.error("An exception has occured when running command: %s", e)
raise
finally:
run_step(ipacontainer, 'cleanup', uid=os.getuid(), gid=os.getgid())
try:
run_step(ipacontainer, 'cleanup', uid=os.getuid(), gid=os.getgid())
except command.ContainerExecError:
logger.error("An exception has occured during cleanup: %s", e)

if args.no_cleanup:
logger.info("Container cleanup suppressed.")
logger.info(
Expand Down

0 comments on commit a022ef9

Please sign in to comment.