From fa2ea50c05f61dc14858ee4d9c5ca44552733313 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 10 Jan 2018 12:45:54 +0100 Subject: docker_creds: fix python3 exception Solves this exception with python3: TypeError: a bytes-like object is required, not 'str Signed-off-by: Giuseppe Scrivano --- roles/lib_utils/library/docker_creds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles/lib_utils') diff --git a/roles/lib_utils/library/docker_creds.py b/roles/lib_utils/library/docker_creds.py index d4674845e..e6f178525 100644 --- a/roles/lib_utils/library/docker_creds.py +++ b/roles/lib_utils/library/docker_creds.py @@ -135,7 +135,7 @@ def update_config(docker_config, registry, username, password): docker_config['auths'][registry] = {} # base64 encode our username:password string - encoded_data = base64.b64encode('{}:{}'.format(username, password)) + encoded_data = base64.b64encode('{}:{}'.format(username, password).encode()) # check if the same value is already present for idempotency. if 'auth' in docker_config['auths'][registry]: -- cgit v1.2.1 From 9585e84e841486ead677c45e441d40368f51032a Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 10 Jan 2018 12:49:32 +0100 Subject: docker_creds: fix python3 exception Fixes: Object of type 'bytes' is not JSON serializable Signed-off-by: Giuseppe Scrivano --- roles/lib_utils/library/docker_creds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles/lib_utils') diff --git a/roles/lib_utils/library/docker_creds.py b/roles/lib_utils/library/docker_creds.py index e6f178525..b94c0b779 100644 --- a/roles/lib_utils/library/docker_creds.py +++ b/roles/lib_utils/library/docker_creds.py @@ -151,7 +151,7 @@ def write_config(module, docker_config, dest): conf_file_path = os.path.join(dest, 'config.json') try: with open(conf_file_path, 'w') as conf_file: - json.dump(docker_config, conf_file, indent=8) + json.dump(docker_config.decode(), conf_file, indent=8) except IOError as ioerror: result = {'failed': True, 'changed': False, -- cgit v1.2.1