From 7363776174a764603343b34111684ab348b22017 Mon Sep 17 00:00:00 2001 From: louis Date: Wed, 1 Mar 2017 15:45:48 +0100 Subject: [PATCH] fixes #19550 (docker_container with empty links list always restarts) --- lib/ansible/modules/cloud/docker/_docker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/docker/_docker.py b/lib/ansible/modules/cloud/docker/_docker.py index cba5c29fc5..fe0f8a5595 100644 --- a/lib/ansible/modules/cloud/docker/_docker.py +++ b/lib/ansible/modules/cloud/docker/_docker.py @@ -1441,7 +1441,10 @@ class DockerManager(object): for link, alias in (self.links or {}).items(): expected_links.add("/{0}:{1}/{2}".format(link, container["Name"], alias)) - actual_links = set(container['HostConfig']['Links'] or []) + actual_links = set() + for link in (container['HostConfig']['Links'] or []): + actual_links.add(link) + if actual_links != expected_links: self.reload_reasons.append('links ({0} => {1})'.format(actual_links, expected_links)) differing.append(container)