From 8743512fa45487319b7c7dbbd9035ca395a91167 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 18 May 2021 21:38:23 +0530 Subject: [PATCH] Don't write to ~/.docker/config.json unnecessarily Also pass indent=4 to pretty print ~/.docker/config.json --- deployer/hub.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deployer/hub.py b/deployer/hub.py index 725b0d06c9..096c02abd2 100644 --- a/deployer/hub.py +++ b/deployer/hub.py @@ -70,10 +70,11 @@ def ensure_docker_credhelpers(self): config = {} helpers = config.get('credHelpers', {}) - helpers[registry] = helper - config['credHelpers'] = helpers - with open(dockercfg_path, 'w') as f: - json.dump(config, f) + if helpers.get(registry) != helper: + helpers[registry] = helper + config['credHelpers'] = helpers + with open(dockercfg_path, 'w') as f: + json.dump(config, f, indent=4) def auth_kubeconfig(self):