@@ -70,20 +70,33 @@ def split_repo_name(repo_name):
7070 return tuple (parts )
7171
7272
73+ def get_credential_store (authconfig , registry ):
74+ if not registry or registry == INDEX_NAME :
75+ registry = 'https://index.docker.io/v1/'
76+
77+ return authconfig .get ('credHelpers' , {}).get (registry ) or authconfig .get (
78+ 'credsStore'
79+ )
80+
81+
7382def resolve_authconfig (authconfig , registry = None ):
7483 """
7584 Returns the authentication data from the given auth configuration for a
7685 specific registry. As with the Docker client, legacy entries in the config
7786 with full URLs are stripped down to hostnames before checking for a match.
7887 Returns None if no match was found.
7988 """
80- if 'credsStore' in authconfig :
81- log .debug (
82- 'Using credentials store "{0}"' .format (authconfig ['credsStore' ])
83- )
84- return _resolve_authconfig_credstore (
85- authconfig , registry , authconfig ['credsStore' ]
86- )
89+
90+ if 'credHelpers' in authconfig or 'credsStore' in authconfig :
91+ store_name = get_credential_store (authconfig , registry )
92+ if store_name is not None :
93+ log .debug (
94+ 'Using credentials store "{0}"' .format (store_name )
95+ )
96+ return _resolve_authconfig_credstore (
97+ authconfig , registry , store_name
98+ )
99+
87100 # Default to the public index server
88101 registry = resolve_index_name (registry ) if registry else INDEX_NAME
89102 log .debug ("Looking for auth entry for {0}" .format (repr (registry )))
@@ -274,6 +287,9 @@ def load_config(config_path=None):
274287 if data .get ('credsStore' ):
275288 log .debug ("Found 'credsStore' section" )
276289 res .update ({'credsStore' : data ['credsStore' ]})
290+ if data .get ('credHelpers' ):
291+ log .debug ("Found 'credHelpers' section" )
292+ res .update ({'credHelpers' : data ['credHelpers' ]})
277293 if res :
278294 return res
279295 else :
0 commit comments