Skip to content

Commit

Permalink
Make info commandthrow exceptions rather than handle them
Browse files Browse the repository at this point in the history
This means it works with the --debug flag, which is useful
  • Loading branch information
bloodearnest committed Aug 21, 2024
1 parent 71114a7 commit e1c1c3b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions opensafely/info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import subprocess
import sys

import opensafely
from opensafely import pull
Expand Down Expand Up @@ -38,15 +37,15 @@ def main():
cpu=info["NCPU"],
)
)
except Exception:
sys.exit("Error retreiving docker information")
except Exception as exc:
raise Exception(f"Error retreiving docker information: {exc}")

print("OpenSAFELY Docker image versions:")
try:
local_images = pull.get_local_images()
updates = pull.check_version(local_images)
except Exception:
sys.exit("Error retreiving image information")
except Exception as exc:
raise Exception(f"Error retreiving image information: {exc}")
else:
for image, sha in sorted(local_images.items()):
update = "(needs update)" if image in updates else "(latest version)"
Expand Down

0 comments on commit e1c1c3b

Please sign in to comment.