Kaydet (Commit) 550c31e2 authored tarafından Erik Johnson's avatar Erik Johnson

Move reload_config func into the APIClient

Also revert an incorrect change in the DaemonApiMixin's login func
Signed-off-by: 's avatarErik Johnson <palehose@gmail.com>
üst 0f843414
......@@ -433,3 +433,17 @@ class APIClient(
@property
def api_version(self):
return self._version
def reload_config(self, dockercfg_path=None):
"""
Force a reload of the auth configuration
Args:
dockercfg_path (str): Use a custom path for the Docker config file
(default ``$HOME/.docker/config.json`` if present,
otherwise``$HOME/.dockercfg``)
Returns:
None
"""
self._auth_configs = auth.load_config(dockercfg_path)
......@@ -123,9 +123,9 @@ class DaemonApiMixin(object):
# If dockercfg_path is passed check to see if the config file exists,
# if so load that config.
if dockercfg_path and os.path.exists(dockercfg_path):
self._auth_configs = self.reload_config(dockercfg_path)
self._auth_configs = auth.load_config(dockercfg_path)
elif not self._auth_configs:
self._auth_configs = self.reload_config()
self._auth_configs = auth.load_config()
authcfg = auth.resolve_authconfig(self._auth_configs, registry)
# If we found an existing auth config for this registry and username
......@@ -174,17 +174,3 @@ class DaemonApiMixin(object):
"""
url = self._url("/version", versioned_api=api_version)
return self._result(self._get(url), json=True)
def reload_config(self, dockercfg_path=None):
"""
Forces a reload of the auth configuration
Args:
dockercfg_path (str): Use a custom path for the Docker config file
(default ``$HOME/.docker/config.json`` if present,
otherwise``$HOME/.dockercfg``)
Returns:
None
"""
self._auth_configs = auth.load_config(dockercfg_path)
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