Handle events for removed containers.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-03-03 18:53:47 -05:00
parent 44c1747127
commit 4cad2a0c5f
1 changed files with 5 additions and 2 deletions

View File

@ -324,8 +324,11 @@ class Project(object):
continue continue
# TODO: get labels from the API v1.22 , see github issue 2618 # TODO: get labels from the API v1.22 , see github issue 2618
# TODO: this can fail if the conatiner is removed, wrap in try/except try:
container = Container.from_id(self.client, event['id']) # this can fail if the conatiner has been removed
container = Container.from_id(self.client, event['id'])
except APIError:
continue
if container.service not in service_names: if container.service not in service_names:
continue continue
yield build_container_event(event, container) yield build_container_event(event, container)