Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docker/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand All @@ -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})'
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/auth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,5 @@ def test_load_config_invalid_auth_dict(self):
with open(dockercfg_path, 'w') as f:
json.dump(config, f)

self.assertRaises(
errors.InvalidConfigFile, auth.load_config, dockercfg_path
)
cfg = auth.load_config(dockercfg_path)
assert cfg == {}