mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-21 04:10:23 -07:00
docker_login: fix internal config file storage to handle credentials for more than one registry (#1118)
* docker_login: fix internal config file storage to handle credentials for more than one registry * Improve setup for docker registry. * Add second registry frontend. Add tests for #1118. * Fix cleanup.
This commit is contained in:
parent
3bc31f286e
commit
16baefd167
9 changed files with 132 additions and 36 deletions
|
@ -257,14 +257,13 @@ class DockerFileStore(object):
|
|||
auth = to_text(b64auth)
|
||||
|
||||
# build up the auth structure
|
||||
new_auth = dict(
|
||||
auths=dict()
|
||||
)
|
||||
new_auth['auths'][server] = dict(
|
||||
if 'auths' not in self._config:
|
||||
self._config['auths'] = dict()
|
||||
|
||||
self._config['auths'][server] = dict(
|
||||
auth=auth
|
||||
)
|
||||
|
||||
self._config.update(new_auth)
|
||||
self._write()
|
||||
|
||||
def erase(self, server):
|
||||
|
@ -272,8 +271,9 @@ class DockerFileStore(object):
|
|||
Remove credentials for the given server from the configuration.
|
||||
'''
|
||||
|
||||
self._config['auths'].pop(server)
|
||||
self._write()
|
||||
if 'auths' in self._config and server in self._config['auths']:
|
||||
self._config['auths'].pop(server)
|
||||
self._write()
|
||||
|
||||
|
||||
class LoginManager(DockerBaseClass):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue