[Fixes #26690] Supports Python 3 handling of base64 encoding (#26876)

* [Fixes #26690] Supports Python 3 handling of base64 encoding

* Set text auth to separate variable for reuse
pull/26934/head
Will Medlar 7 years ago committed by Toshio Kuratomi
parent 42ca1ef040
commit 3f67d167fe

@ -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…
Cancel
Save