diff options
author | Joffrey F <joffrey@docker.com> | 2016-08-22 19:12:27 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2016-08-23 14:52:07 -0700 |
commit | 775b581c04dfa5f7d421ad74f969f25869fa8151 (patch) | |
tree | 4852aea751667ba0b127c111aac95d61b0e0b96f /docker/auth/auth.py | |
parent | 7d5a1eeb7a46f17136aaf1041660d043a85051fc (diff) | |
download | docker-py-1085-service-support.tar.gz |
Private images support in create_service / update_service1085-service-support
Refactor auth header computation
Add tasks methods and documentation.
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/auth/auth.py')
-rw-r--r-- | docker/auth/auth.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docker/auth/auth.py b/docker/auth/auth.py index b61a8d0..7195f56 100644 --- a/docker/auth/auth.py +++ b/docker/auth/auth.py @@ -51,6 +51,26 @@ def resolve_index_name(index_name): return index_name +def get_config_header(client, registry): + log.debug('Looking for auth config') + if not client._auth_configs: + log.debug( + "No auth config in memory - loading from filesystem" + ) + client._auth_configs = load_config() + authcfg = resolve_authconfig(client._auth_configs, registry) + # Do not fail here if no authentication exists for this + # specific registry as we can have a readonly pull. Just + # put the header if we can. + if authcfg: + log.debug('Found auth config') + # auth_config needs to be a dict in the format used by + # auth.py username , password, serveraddress, email + return encode_header(authcfg) + log.debug('No auth config found') + return None + + def split_repo_name(repo_name): parts = repo_name.split('/', 1) if len(parts) == 1 or ( |