Skip to content

Commit

Permalink
fix prune bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarin91 committed Dec 12, 2017
1 parent 94d7a54 commit 9049074
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tosker/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def log(self, component, interface):
def prune(self):
self._print_loading_start('Remove containers.. ')
con = docker_interface.get_containers(all=True)
for c in (c for c in con if c['Names'][0].startswith('/tosker')):
for c in (c for c in con if c['Names'] and c['Names'][0].startswith('/tosker')):
self._log.debug(c['Names'][0])
docker_interface.delete_container(c['Id'], force=True)
self._print_tick()
Expand All @@ -283,7 +283,8 @@ def prune(self):

self._print_loading_start('Remove images.. ')
images = docker_interface.get_images()
for i in (i for i in images if i['RepoTags'][0].startswith('tosker')):
for i in (i for i in images
if i['RepoTags'] and i['RepoTags'][0].startswith('tosker')):
self._log.debug(i['RepoTags'][0])
docker_interface.delete_image(i['Id'])
self._print_tick()
Expand Down

0 comments on commit 9049074

Please sign in to comment.