Fix container stop exeption

Change-Id: I1d59ed9089def808bab31d97ba4cba9e8592b568
Closes-Bug: #1595814
This commit is contained in:
MD NADEEM 2016-06-24 10:52:28 +05:30 committed by Md Nadeem
parent dfb0e55740
commit 3321049158

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)