@@ -44,7 +44,9 @@ def get_config_header(client, registry):
44
44
"No auth config in memory - loading from filesystem"
45
45
)
46
46
client ._auth_configs = load_config ()
47
- authcfg = resolve_authconfig (client ._auth_configs , registry )
47
+ authcfg = resolve_authconfig (
48
+ client ._auth_configs , registry , credstore_env = client .credstore_env
49
+ )
48
50
# Do not fail here if no authentication exists for this
49
51
# specific registry as we can have a readonly pull. Just
50
52
# put the header if we can.
@@ -76,7 +78,7 @@ def get_credential_store(authconfig, registry):
76
78
)
77
79
78
80
79
- def resolve_authconfig (authconfig , registry = None ):
81
+ def resolve_authconfig (authconfig , registry = None , credstore_env = None ):
80
82
"""
81
83
Returns the authentication data from the given auth configuration for a
82
84
specific registry. As with the Docker client, legacy entries in the config
@@ -91,7 +93,7 @@ def resolve_authconfig(authconfig, registry=None):
91
93
'Using credentials store "{0}"' .format (store_name )
92
94
)
93
95
cfg = _resolve_authconfig_credstore (
94
- authconfig , registry , store_name
96
+ authconfig , registry , store_name , env = credstore_env
95
97
)
96
98
if cfg is not None :
97
99
return cfg
@@ -115,13 +117,14 @@ def resolve_authconfig(authconfig, registry=None):
115
117
return None
116
118
117
119
118
- def _resolve_authconfig_credstore (authconfig , registry , credstore_name ):
120
+ def _resolve_authconfig_credstore (authconfig , registry , credstore_name ,
121
+ env = None ):
119
122
if not registry or registry == INDEX_NAME :
120
123
# The ecosystem is a little schizophrenic with index.docker.io VS
121
124
# docker.io - in that case, it seems the full URL is necessary.
122
125
registry = INDEX_URL
123
126
log .debug ("Looking for auth entry for {0}" .format (repr (registry )))
124
- store = dockerpycreds .Store (credstore_name )
127
+ store = dockerpycreds .Store (credstore_name , environment = env )
125
128
try :
126
129
data = store .get (registry )
127
130
res = {
0 commit comments