fix exception when an image has no name
This prevents an exception from occurring when an image has no name. While images normally have names it is possible, at least on older versions of Docker, for an image to "lose" its name during a failed `docker rm`.
This commit is contained in:
parent
df49952c48
commit
5aac2a4240
1 changed files with 1 additions and 1 deletions
|
@ -349,7 +349,7 @@ class AnsibleDockerClient(Client):
|
||||||
try:
|
try:
|
||||||
for container in self.containers(all=True):
|
for container in self.containers(all=True):
|
||||||
self.log("testing container: %s" % (container['Names']))
|
self.log("testing container: %s" % (container['Names']))
|
||||||
if search_name in container['Names']:
|
if isinstance(container['Names'], list) and search_name in container['Names']:
|
||||||
result = container
|
result = container
|
||||||
break
|
break
|
||||||
if container['Id'].startswith(name):
|
if container['Id'].startswith(name):
|
||||||
|
|
Loading…
Reference in a new issue