From 11faafcbf7d3dad761d43ef67f9733ecb45423a1 Mon Sep 17 00:00:00 2001 From: UnderwayNYC Date: Mon, 30 Oct 2017 15:53:08 -0400 Subject: [PATCH] Fix error when there are no docker volumes present yet (#28145) * Fix error when there are no docker volumes present yet * fixes suggested by Shippable --- lib/ansible/modules/cloud/docker/docker_volume.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/modules/cloud/docker/docker_volume.py b/lib/ansible/modules/cloud/docker/docker_volume.py index e0b61457de..31ced623de 100644 --- a/lib/ansible/modules/cloud/docker/docker_volume.py +++ b/lib/ansible/modules/cloud/docker/docker_volume.py @@ -149,6 +149,9 @@ class DockerVolumeManager(object): except APIError as e: self.client.fail(text_type(e)) + if volumes[u'Volumes'] is None: + return None + for volume in volumes[u'Volumes']: if volume['Name'] == self.parameters.volume_name: return volume