mirror of https://github.com/docker/docker-py.git
Better credentials store error handling in resolve_authconfig
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
fbe1686e62
commit
219a8699f9
|
|
@ -106,8 +106,6 @@ def _resolve_authconfig_credstore(authconfig, registry, credstore_name):
|
||||||
# docker.io - in that case, it seems the full URL is necessary.
|
# docker.io - in that case, it seems the full URL is necessary.
|
||||||
registry = 'https://index.docker.io/v1/'
|
registry = 'https://index.docker.io/v1/'
|
||||||
log.debug("Looking for auth entry for {0}".format(repr(registry)))
|
log.debug("Looking for auth entry for {0}".format(repr(registry)))
|
||||||
if registry not in authconfig:
|
|
||||||
log.debug("No entry found")
|
|
||||||
store = dockerpycreds.Store(credstore_name)
|
store = dockerpycreds.Store(credstore_name)
|
||||||
try:
|
try:
|
||||||
data = store.get(registry)
|
data = store.get(registry)
|
||||||
|
|
@ -122,10 +120,13 @@ def _resolve_authconfig_credstore(authconfig, registry, credstore_name):
|
||||||
'Password': data['Secret'],
|
'Password': data['Secret'],
|
||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
|
except dockerpycreds.CredentialsNotFound as e:
|
||||||
|
log.debug('No entry found')
|
||||||
|
return None
|
||||||
except dockerpycreds.StoreError as e:
|
except dockerpycreds.StoreError as e:
|
||||||
log.error('Credentials store error: {0}'.format(repr(e)))
|
raise errors.DockerException(
|
||||||
|
'Credentials store error: {0}'.format(repr(e))
|
||||||
return None
|
)
|
||||||
|
|
||||||
|
|
||||||
def convert_to_hostname(url):
|
def convert_to_hostname(url):
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,4 @@ six>=1.4.0
|
||||||
websocket-client==0.32.0
|
websocket-client==0.32.0
|
||||||
backports.ssl_match_hostname>=3.5 ; python_version < '3.5'
|
backports.ssl_match_hostname>=3.5 ; python_version < '3.5'
|
||||||
ipaddress==1.0.16 ; python_version < '3.3'
|
ipaddress==1.0.16 ; python_version < '3.3'
|
||||||
docker-pycreds==0.1.0
|
docker-pycreds==0.2.0
|
||||||
2
setup.py
2
setup.py
|
|
@ -12,7 +12,7 @@ requirements = [
|
||||||
'requests >= 2.5.2, < 2.11',
|
'requests >= 2.5.2, < 2.11',
|
||||||
'six >= 1.4.0',
|
'six >= 1.4.0',
|
||||||
'websocket-client >= 0.32.0',
|
'websocket-client >= 0.32.0',
|
||||||
'docker-pycreds >= 0.1.0'
|
'docker-pycreds >= 0.2.0'
|
||||||
]
|
]
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue