From e998090d52aa0cc282073a3ae5a19e26e3761330 Mon Sep 17 00:00:00 2001 From: Olaf Kilian Date: Wed, 6 May 2015 22:43:28 +0200 Subject: [PATCH] Extract only the hostname part from self.registry This is needed for update_dockercfg() to register only the host part of a specified registry URL in the .dockercfg. --- lib/ansible/modules/extras/cloud/docker/docker_login.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/extras/cloud/docker/docker_login.py b/lib/ansible/modules/extras/cloud/docker/docker_login.py index db8fa90632..be5a46977a 100644 --- a/lib/ansible/modules/extras/cloud/docker/docker_login.py +++ b/lib/ansible/modules/extras/cloud/docker/docker_login.py @@ -139,6 +139,10 @@ class DockerLoginManager: if self.reauth: self.log.append("Enforcing reauthentification") + # Extract hostname part from self.registry if url was specified. + registry_url = urlparse(self.registry) + self.registry = registry_url.netloc or registry_url.path + # Connect to registry and login if not already logged in or reauth is enforced. try: self.response = self.client.login(