mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-19 02:11:32 +00:00
docker_login: fix internal config file storage to handle credentials for more than one registry (#1118) (#1145)
* 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.
(cherry picked from commit 16baefd167)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
7da1f3ffea
commit
b56857932e
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