diff options
| author | Erik Johnson <palehose@gmail.com> | 2017-05-02 16:23:41 -0500 |
|---|---|---|
| committer | Erik Johnson <palehose@gmail.com> | 2017-05-02 16:26:35 -0500 |
| commit | 550c31e2b701ddaa275f5b260e702987638467dc (patch) | |
| tree | 6e15ddb52f6e10f75205edc2dcd050357d04bab7 | |
| parent | 0f843414e5b4ba4c2344abb8bf3489eedba055d3 (diff) | |
| download | docker-py-550c31e2b701ddaa275f5b260e702987638467dc.tar.gz | |
Move reload_config func into the APIClient
Also revert an incorrect change in the DaemonApiMixin's login func
Signed-off-by: Erik Johnson <palehose@gmail.com>
| -rw-r--r-- | docker/api/client.py | 14 | ||||
| -rw-r--r-- | docker/api/daemon.py | 18 |
2 files changed, 16 insertions, 16 deletions
diff --git a/docker/api/client.py b/docker/api/client.py index 749b061..54ec6ab 100644 --- a/docker/api/client.py +++ b/docker/api/client.py @@ -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) diff --git a/docker/api/daemon.py b/docker/api/daemon.py index aa93643..91c777f 100644 --- a/docker/api/daemon.py +++ b/docker/api/daemon.py @@ -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) |
