Kaydet (Commit) bc84ed11 authored tarafından Joffrey F's avatar Joffrey F

Fix empty authconfig detection

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst c344660f
...@@ -286,10 +286,10 @@ class BuildApiMixin(object): ...@@ -286,10 +286,10 @@ class BuildApiMixin(object):
# If we don't have any auth data so far, try reloading the config # If we don't have any auth data so far, try reloading the config
# file one more time in case anything showed up in there. # file one more time in case anything showed up in there.
if not self._auth_configs: if not self._auth_configs or self._auth_configs.is_empty:
log.debug("No auth config in memory - loading from filesystem") log.debug("No auth config in memory - loading from filesystem")
self._auth_configs = auth.load_config( self._auth_configs = auth.load_config(
credsore_env=self.credsore_env credstore_env=self.credstore_env
) )
# Send the full auth configuration (if any exists), since the build # Send the full auth configuration (if any exists), since the build
......
...@@ -127,7 +127,7 @@ class DaemonApiMixin(object): ...@@ -127,7 +127,7 @@ class DaemonApiMixin(object):
self._auth_configs = auth.load_config( self._auth_configs = auth.load_config(
dockercfg_path, credstore_env=self.credstore_env dockercfg_path, credstore_env=self.credstore_env
) )
elif not self._auth_configs: elif not self._auth_configs or self._auth_configs.is_empty:
self._auth_configs = auth.load_config( self._auth_configs = auth.load_config(
credstore_env=self.credstore_env credstore_env=self.credstore_env
) )
......
...@@ -39,7 +39,7 @@ def resolve_index_name(index_name): ...@@ -39,7 +39,7 @@ def resolve_index_name(index_name):
def get_config_header(client, registry): def get_config_header(client, registry):
log.debug('Looking for auth config') log.debug('Looking for auth config')
if not client._auth_configs: if not client._auth_configs or client._auth_configs.is_empty:
log.debug( log.debug(
"No auth config in memory - loading from filesystem" "No auth config in memory - loading from filesystem"
) )
...@@ -212,6 +212,12 @@ class AuthConfig(dict): ...@@ -212,6 +212,12 @@ class AuthConfig(dict):
def cred_helpers(self): def cred_helpers(self):
return self.get('credHelpers', {}) return self.get('credHelpers', {})
@property
def is_empty(self):
return (
not self.auths and not self.creds_store and not self.cred_helpers
)
def resolve_authconfig(self, registry=None): def resolve_authconfig(self, registry=None):
""" """
Returns the authentication data from the given auth configuration for a Returns the authentication data from the given auth configuration for a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment