Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Commit

Permalink
Move the exit code check in Helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor committed Jun 6, 2017
1 parent 5a3d076 commit 1358fd5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/docker_creds_.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,16 @@ def Get(self):
stdin=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout = p.communicate(input=self._registry)[0]
if p.returncode != 0:
raise Exception('Error fetching credential for %s, exit status: %d\n%s'
% (self._name, p.returncode, stdout))

output = stdout.decode()
if output.strip() == _MAGIC_NOT_FOUND_MESSAGE:
# Use empty auth when no auth is found.
return Anonymous().Get()

if p.returncode != 0:
raise Exception('Error fetching credential for %s, exit status: %d\n%s'
% (self._name, p.returncode, stdout))

blob = json.loads(output)
return Basic(blob['Username'], blob['Secret']).Get()

Expand Down

0 comments on commit 1358fd5

Please sign in to comment.