Skip to content

Commit 550c31e

Browse files
committed
Move reload_config func into the APIClient
Also revert an incorrect change in the DaemonApiMixin's login func Signed-off-by: Erik Johnson <[email protected]>
1 parent 0f84341 commit 550c31e

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

docker/api/client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,17 @@ def get_adapter(self, url):
433433
@property
434434
def api_version(self):
435435
return self._version
436+
437+
def reload_config(self, dockercfg_path=None):
438+
"""
439+
Force a reload of the auth configuration
440+
441+
Args:
442+
dockercfg_path (str): Use a custom path for the Docker config file
443+
(default ``$HOME/.docker/config.json`` if present,
444+
otherwise``$HOME/.dockercfg``)
445+
446+
Returns:
447+
None
448+
"""
449+
self._auth_configs = auth.load_config(dockercfg_path)

docker/api/daemon.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ def login(self, username, password=None, email=None, registry=None,
123123
# If dockercfg_path is passed check to see if the config file exists,
124124
# if so load that config.
125125
if dockercfg_path and os.path.exists(dockercfg_path):
126-
self._auth_configs = self.reload_config(dockercfg_path)
126+
self._auth_configs = auth.load_config(dockercfg_path)
127127
elif not self._auth_configs:
128-
self._auth_configs = self.reload_config()
128+
self._auth_configs = auth.load_config()
129129

130130
authcfg = auth.resolve_authconfig(self._auth_configs, registry)
131131
# If we found an existing auth config for this registry and username
@@ -174,17 +174,3 @@ def version(self, api_version=True):
174174
"""
175175
url = self._url("/version", versioned_api=api_version)
176176
return self._result(self._get(url), json=True)
177-
178-
def reload_config(self, dockercfg_path=None):
179-
"""
180-
Forces a reload of the auth configuration
181-
182-
Args:
183-
dockercfg_path (str): Use a custom path for the Docker config file
184-
(default ``$HOME/.docker/config.json`` if present,
185-
otherwise``$HOME/.dockercfg``)
186-
187-
Returns:
188-
None
189-
"""
190-
self._auth_configs = auth.load_config(dockercfg_path)

0 commit comments

Comments
 (0)