Skip to content

Commit

Permalink
Don't write to ~/.docker/config.json unnecessarily
Browse files Browse the repository at this point in the history
Also pass indent=4 to pretty print ~/.docker/config.json
  • Loading branch information
yuvipanda committed May 18, 2021
1 parent 807ee92 commit 8743512
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions deployer/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8743512

Please sign in to comment.