Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/api/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ def _set_auth_headers(self, headers):

# 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.
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")
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
Expand Down
2 changes: 1 addition & 1 deletion docker/api/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def login(self, username, password=None, email=None, registry=None,
self._auth_configs = auth.load_config(
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(
credstore_env=self.credstore_env
)
Expand Down
8 changes: 7 additions & 1 deletion docker/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def resolve_index_name(index_name):

def get_config_header(client, registry):
log.debug('Looking for auth config')
if not client._auth_configs:
if not client._auth_configs or client._auth_configs.is_empty:
log.debug(
"No auth config in memory - loading from filesystem"
)
Expand Down Expand Up @@ -212,6 +212,12 @@ def creds_store(self):
def cred_helpers(self):
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):
"""
Returns the authentication data from the given auth configuration for a
Expand Down