mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* [Fixes #26690] Supports Python 3 handling of base64 encoding * Set text auth to separate variable for reuse
This commit is contained in:
parent
42ca1ef040
commit
3f67d167fe
1 changed files with 7 additions and 1 deletions
|
@ -143,6 +143,7 @@ login_results:
|
|||
|
||||
import base64
|
||||
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.module_utils.docker_common import *
|
||||
|
||||
|
||||
|
@ -276,8 +277,13 @@ class LoginManager(DockerBaseClass):
|
|||
self.log("Adding registry_url %s to auths." % (self.registry_url))
|
||||
config['auths'][self.registry_url] = dict()
|
||||
|
||||
b64auth = base64.b64encode(
|
||||
to_bytes(self.username) + b':' + to_bytes(self.password)
|
||||
)
|
||||
auth = to_text(b64auth)
|
||||
|
||||
encoded_credentials = dict(
|
||||
auth=base64.b64encode(self.username + b':' + self.password),
|
||||
auth=auth,
|
||||
email=self.email
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue