summaryrefslogtreecommitdiff
path: root/docker/auth/auth.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2016-04-05 12:52:22 -0700
committerJoffrey F <joffrey@docker.com>2016-04-05 14:52:26 -0700
commit5885e6235473b6622a66adf435fdff589570fc17 (patch)
tree24baa9d6801fb32e2527310335360bc26f2fd71c /docker/auth/auth.py
parente743254b42080e6d199fc10f4812a42ecb8d536f (diff)
downloaddocker-py-1021-empty-auth.tar.gz
Don't raise InvalidConfigError when auth dict doesn't have an 'auth' key1021-empty-auth
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/auth/auth.py')
-rw-r--r--docker/auth/auth.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/docker/auth/auth.py b/docker/auth/auth.py
index eedb794..d23e6f3 100644
--- a/docker/auth/auth.py
+++ b/docker/auth/auth.py
@@ -117,7 +117,7 @@ def parse_auth(entries, raise_on_error=False):
conf = {}
for registry, entry in six.iteritems(entries):
- if not (isinstance(entry, dict) and 'auth' in entry):
+ if not isinstance(entry, dict):
log.debug(
'Config entry for key {0} is not auth config'.format(registry)
)
@@ -130,6 +130,16 @@ def parse_auth(entries, raise_on_error=False):
'Invalid configuration for registry {0}'.format(registry)
)
return {}
+ if 'auth' not in entry:
+ # Starting with engine v1.11 (API 1.23), an empty dictionary is
+ # a valid value in the auths config.
+ # https://github.com/docker/compose/issues/3265
+ log.debug(
+ 'Auth data for {0} is absent. Client might be using a '
+ 'credentials store instead.'
+ )
+ return {}
+
username, password = decode_auth(entry['auth'])
log.debug(
'Found entry (registry={0}, username={1})'
@@ -189,6 +199,9 @@ def load_config(config_path=None):
if data.get('HttpHeaders'):
log.debug("Found 'HttpHeaders' section")
res.update({'HttpHeaders': data['HttpHeaders']})
+ if data.get('credsStore'):
+ log.debug("Found 'credsStore' section")
+ res.update({'credsStore': data['credsStore']})
if res:
return res
else: