Merge "Fix container stop exeption"

This commit is contained in:
Jenkins 2016-06-27 04:45:06 +00:00 committed by Gerrit Code Review
commit dafd1c8c2e

View File

@ -603,7 +603,10 @@ class DockerWorker(object):
def stop_container(self):
name = self.params.get('name')
container = self.check_container()
if not container['Status'].startswith('Exited '):
if not container:
self.module.fail_json(
msg="No such container: {} to stop".format(name))
elif not container['Status'].startswith('Exited '):
self.changed = True
self.dc.stop(name)