mirror of https://github.com/docker/docker-py.git
Fix authconfig resolution when credStore is used combined with login()
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
14eec99bed
commit
3498b63fb0
|
|
@ -90,9 +90,12 @@ def resolve_authconfig(authconfig, registry=None):
|
|||
log.debug(
|
||||
'Using credentials store "{0}"'.format(store_name)
|
||||
)
|
||||
return _resolve_authconfig_credstore(
|
||||
cfg = _resolve_authconfig_credstore(
|
||||
authconfig, registry, store_name
|
||||
)
|
||||
if cfg is not None:
|
||||
return cfg
|
||||
log.debug('No entry in credstore - fetching from auth dict')
|
||||
|
||||
# Default to the public index server
|
||||
registry = resolve_index_name(registry) if registry else INDEX_NAME
|
||||
|
|
|
|||
|
|
@ -210,6 +210,19 @@ class ResolveAuthTest(unittest.TestCase):
|
|||
self.auth_config, auth.resolve_repository_name(image)[0]
|
||||
) is None
|
||||
|
||||
def test_resolve_auth_with_empty_credstore_and_auth_dict(self):
|
||||
auth_config = {
|
||||
'auths': auth.parse_auth({
|
||||
'https://index.docker.io/v1/': self.index_config,
|
||||
}),
|
||||
'credsStore': 'blackbox'
|
||||
}
|
||||
with mock.patch('docker.auth._resolve_authconfig_credstore') as m:
|
||||
m.return_value = None
|
||||
assert 'indexuser' == auth.resolve_authconfig(
|
||||
auth_config, None
|
||||
)['username']
|
||||
|
||||
|
||||
class CredStoreTest(unittest.TestCase):
|
||||
def test_get_credential_store(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue