aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamYaple <sam@yaple.net>2016-01-28 02:43:55 +0000
committerSamYaple <sam@yaple.net>2016-01-28 03:06:05 +0000
commit4649279c9d14b70a0155b13eb6982a82c0fc5877 (patch)
treea7652cfccaf6b9d6d6e55f04eb30b6692698d0fd
parent2361fddcffbae32fa681db1b2de4530bb65cd0e5 (diff)
downloadkolla-4649279c9d14b70a0155b13eb6982a82c0fc5877.tar.gz
kolla-4649279c9d14b70a0155b13eb6982a82c0fc5877.zip
Rework log output if pull fails
Co-Authored-By: Sam Yaple <sam@yaple.net> Change-Id: I066b2d419abb3ef2d4827ce686865c0dc68a5e97 Closes-bug: #1537763
-rw-r--r--ansible/library/kolla_docker.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/ansible/library/kolla_docker.py b/ansible/library/kolla_docker.py
index 3a1958c7c..bc751cc93 100644
--- a/ansible/library/kolla_docker.py
+++ b/ansible/library/kolla_docker.py
@@ -337,23 +337,35 @@ class DockerWorker(object):
]
for status in reversed(statuses):
- # NOTE(jeffrey4l): Get the last not empty status with status
- # property
+ if 'error' in status:
+ if status['error'].endswith('not found'):
+ self.module.fail_json(
+ msg="The requested image does not exist: {}:{}".format(
+ image, tag),
+ failed=True
+ )
+ else:
+ self.module.fail_json(
+ msg="Unknown error message: {}".format(
+ status['error']),
+ failed=True
+ )
+
if status and status.get('status'):
# NOTE(SamYaple): This allows us to use v1 and v2 docker
# registries. Eventually docker will stop supporting v1
# registries and when that happens we can remove this.
- if 'legacy registry' in status.get('status'):
+ if 'legacy registry' in status['status']:
continue
- elif "Downloaded newer image for" in status.get('status'):
+ elif 'Downloaded newer image for' in status['status']:
self.changed = True
return
- elif "Image is up to date for" in status.get('status'):
+ elif 'Image is up to date for' in status['status']:
return
else:
self.module.fail_json(
- msg="Invalid status returned from pull",
- changed=True,
+ msg="Unknown status message: {}".format(
+ status['status']),
failed=True
)