From 3321049158ee2b3758fbb610f1caf863956fc101 Mon Sep 17 00:00:00 2001 From: MD NADEEM Date: Fri, 24 Jun 2016 10:52:28 +0530 Subject: [PATCH] Fix container stop exeption Change-Id: I1d59ed9089def808bab31d97ba4cba9e8592b568 Closes-Bug: #1595814 --- ansible/library/kolla_docker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible/library/kolla_docker.py b/ansible/library/kolla_docker.py index 7c60deb5d8..81c41cfd26 100644 --- a/ansible/library/kolla_docker.py +++ b/ansible/library/kolla_docker.py @@ -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)