Ignore containers without names

This commit is contained in:
Ben Firshman 2013-12-20 12:51:20 +00:00
parent 86e551f2e2
commit 15f12c6e2c
1 changed files with 3 additions and 1 deletions

View File

@ -31,7 +31,7 @@ class Service(object):
l = []
for container in self.client.containers(all=stopped):
name = get_container_name(container)
if not is_valid_name(name, one_off):
if not name or not is_valid_name(name, one_off):
continue
project, name, number = parse_name(name)
if project == self.project and name == self.name:
@ -183,6 +183,8 @@ def parse_name(name, one_off=False):
def get_container_name(container):
if not container.get('Name') and not container.get('Names'):
return None
# inspect
if 'Name' in container:
return container['Name']