summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2016-09-06 14:58:41 -0700
committerJoffrey F <joffrey@docker.com>2016-09-06 15:17:36 -0700
commit219a8699f9c92de9cb4634d482ce700bb1ec76fc (patch)
tree948be2b02ecc6c700aa59c33cf58bc45273a9978
parentfbe1686e629804fb47dabea1eda5c6d664f0a6b7 (diff)
downloaddocker-py-credstore-support.tar.gz
Better credentials store error handling in resolve_authconfigcredstore-support
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r--docker/auth/auth.py11
-rw-r--r--requirements.txt2
-rw-r--r--setup.py2
3 files changed, 8 insertions, 7 deletions
diff --git a/docker/auth/auth.py b/docker/auth/auth.py
index fdaa7b5..ea15def 100644
--- a/docker/auth/auth.py
+++ b/docker/auth/auth.py
@@ -106,8 +106,6 @@ def _resolve_authconfig_credstore(authconfig, registry, credstore_name):
# docker.io - in that case, it seems the full URL is necessary.
registry = 'https://index.docker.io/v1/'
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)
try:
data = store.get(registry)
@@ -122,10 +120,13 @@ def _resolve_authconfig_credstore(authconfig, registry, credstore_name):
'Password': data['Secret'],
})
return res
+ except dockerpycreds.CredentialsNotFound as e:
+ log.debug('No entry found')
+ return None
except dockerpycreds.StoreError as e:
- log.error('Credentials store error: {0}'.format(repr(e)))
-
- return None
+ raise errors.DockerException(
+ 'Credentials store error: {0}'.format(repr(e))
+ )
def convert_to_hostname(url):
diff --git a/requirements.txt b/requirements.txt
index 078163a..4c0d5c2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,4 +3,4 @@ six>=1.4.0
websocket-client==0.32.0
backports.ssl_match_hostname>=3.5 ; python_version < '3.5'
ipaddress==1.0.16 ; python_version < '3.3'
-docker-pycreds==0.1.0 \ No newline at end of file
+docker-pycreds==0.2.0 \ No newline at end of file
diff --git a/setup.py b/setup.py
index 3877e96..1afd873 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ requirements = [
'requests >= 2.5.2, < 2.11',
'six >= 1.4.0',
'websocket-client >= 0.32.0',
- 'docker-pycreds >= 0.1.0'
+ 'docker-pycreds >= 0.2.0'
]
if sys.platform == 'win32':