Skip to content

Commit

Permalink
Merge pull request #320 from NERSC/auth_response2
Browse files Browse the repository at this point in the history
Handle more auth responses
  • Loading branch information
scanon authored Mar 11, 2022
2 parents 5e43a5c + d6a1876 commit 61abee4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions imagegw/shifter_imagegw/dockerv2_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ def _inspect(self):
process = Popen(cmd, stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
stderr_str = stderr.decode("utf-8")
if 'authentication required' not in stderr_str and 'Forbidden' not in stderr_str:
auth_errors = ['authentication', 'forbidden', 'unauthorized']
# see if we got some type of unauthorized response
if not any(a_err in stderr_str.lower() for a_err in auth_errors):
# See if it exited with an error
if process.returncode:
raise OSError("Skopeo inspect failed")
raise OSError("Skopeo inspect failed: %s" % (stderr_str))
return json.loads(stdout.decode("utf-8"))

# Private Image
Expand Down

0 comments on commit 61abee4

Please sign in to comment.