Skip to content

Commit 219a869

Browse files
committed
Better credentials store error handling in resolve_authconfig
Signed-off-by: Joffrey F <[email protected]>
1 parent fbe1686 commit 219a869

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

docker/auth/auth.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ def _resolve_authconfig_credstore(authconfig, registry, credstore_name):
106106
# docker.io - in that case, it seems the full URL is necessary.
107107
registry = 'https://index.docker.io/v1/'
108108
log.debug("Looking for auth entry for {0}".format(repr(registry)))
109-
if registry not in authconfig:
110-
log.debug("No entry found")
111109
store = dockerpycreds.Store(credstore_name)
112110
try:
113111
data = store.get(registry)
@@ -122,10 +120,13 @@ def _resolve_authconfig_credstore(authconfig, registry, credstore_name):
122120
'Password': data['Secret'],
123121
})
124122
return res
123+
except dockerpycreds.CredentialsNotFound as e:
124+
log.debug('No entry found')
125+
return None
125126
except dockerpycreds.StoreError as e:
126-
log.error('Credentials store error: {0}'.format(repr(e)))
127-
128-
return None
127+
raise errors.DockerException(
128+
'Credentials store error: {0}'.format(repr(e))
129+
)
129130

130131

131132
def convert_to_hostname(url):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ six>=1.4.0
33
websocket-client==0.32.0
44
backports.ssl_match_hostname>=3.5 ; python_version < '3.5'
55
ipaddress==1.0.16 ; python_version < '3.3'
6-
docker-pycreds==0.1.0
6+
docker-pycreds==0.2.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
'requests >= 2.5.2, < 2.11',
1313
'six >= 1.4.0',
1414
'websocket-client >= 0.32.0',
15-
'docker-pycreds >= 0.1.0'
15+
'docker-pycreds >= 0.2.0'
1616
]
1717

1818
if sys.platform == 'win32':

0 commit comments

Comments
 (0)