Skip to content

Commit

Permalink
Removes an error message when destroying docker
Browse files Browse the repository at this point in the history
If the 'upload' and 'download' commands have never been used, the
current image and the initial image are one and the same. Deleting the
second time would previously log an error, although everything went
smooth.
  • Loading branch information
remram44 committed Feb 2, 2015
1 parent 578a147 commit 3cce36c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog
Bugfixes:
* Fixes `debug` log messages not being printed
* Pressing Ctrl+C wouldn't stop package identification with KeyboardInterrupt
* Fixes an error message while destroying a docker experiment

0.5.1 (2014-12-18)
------------------
Expand Down
20 changes: 11 additions & 9 deletions reprounzip-docker/reprounzip/unpackers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,18 +417,20 @@ def docker_destroy_docker(args):
logging.error("Error deleting container %s",
container.decode('ascii'))

initial_image = unpacked_info.pop('initial_image')

if 'current_image' in unpacked_info:
image = unpacked_info.pop('current_image')
logging.info("Destroying image %s...", image.decode('ascii'))
retcode = subprocess.call(['docker', 'rmi', image])
if retcode != 0:
logging.error("Error deleting image %s", image.decode('ascii'))

image = unpacked_info.pop('initial_image')
logging.info("Destroying image %s...", image.decode('ascii'))
retcode = subprocess.call(['docker', 'rmi', image])
if image != initial_image:
logging.info("Destroying image %s...", image.decode('ascii'))
retcode = subprocess.call(['docker', 'rmi', image])
if retcode != 0:
logging.error("Error deleting image %s", image.decode('ascii'))

logging.info("Destroying image %s...", initial_image.decode('ascii'))
retcode = subprocess.call(['docker', 'rmi', initial_image])
if retcode != 0:
logging.error("Error deleting image %s", image.decode('ascii'))
logging.error("Error deleting image %s", initial_image.decode('ascii'))


@target_must_exist
Expand Down

0 comments on commit 3cce36c

Please sign in to comment.