summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Rutkovsky <vrutkovs@redhat.com>2018-01-30 12:32:52 +0100
committerVadim Rutkovsky <vrutkovs@redhat.com>2018-01-30 12:32:52 +0100
commitd7741d8bc0f0f320cb061bf63bcd2629b5e583a9 (patch)
tree3dbb742106f60c4f881a8b6df0c4756b50130f4e
parent844156f49a1899dd9d6059207bf63e6d8b865ec6 (diff)
downloadopenshift-d7741d8bc0f0f320cb061bf63bcd2629b5e583a9.tar.gz
openshift-d7741d8bc0f0f320cb061bf63bcd2629b5e583a9.tar.bz2
openshift-d7741d8bc0f0f320cb061bf63bcd2629b5e583a9.tar.xz
openshift-d7741d8bc0f0f320cb061bf63bcd2629b5e583a9.zip
docker_creds: decode docker_config for py3 only if its a string
-rw-r--r--roles/lib_utils/library/docker_creds.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/roles/lib_utils/library/docker_creds.py b/roles/lib_utils/library/docker_creds.py
index b94c0b779..936fb1c38 100644
--- a/roles/lib_utils/library/docker_creds.py
+++ b/roles/lib_utils/library/docker_creds.py
@@ -148,10 +148,12 @@ def update_config(docker_config, registry, username, password):
def write_config(module, docker_config, dest):
'''Write updated credentials into dest/config.json'''
+ if not isinstance(docker_config, dict):
+ docker_config = docker_config.decode()
conf_file_path = os.path.join(dest, 'config.json')
try:
with open(conf_file_path, 'w') as conf_file:
- json.dump(docker_config.decode(), conf_file, indent=8)
+ json.dump(docker_config, conf_file, indent=8)
except IOError as ioerror:
result = {'failed': True,
'changed': False,