Skip to content

Commit

Permalink
fix: Properly fail if publish hasn't been created yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkor333 committed Jul 24, 2024
1 parent 0bd799f commit 8045a66
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pyaptly/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ def publish_cmd_update(cfg, publish_name, publish_config, ignore_existing=False)
return cmd

publish_fullname = "%s %s" % (publish_name, publish_config["distribution"])
# This line might fail if no publish has been created yet
# TODO: add clag --create to create publishes when they haven't been created yet
# TODO: add flag --create to create publishes when they haven't been created yet
# TODO: Fail gracefully and show an error when there is no existing publish
current_snapshots = state_reader.state_reader().publish_map()[publish_fullname]
try:
current_snapshots = state_reader.state_reader().publish_map()[publish_fullname]
except KeyError as e:
util.exit_with_error("The publish hasn't been created yet: " + e)
if "snapshots" in publish_config:
snapshots_config = publish_config["snapshots"]
new_snapshots = [
Expand Down

0 comments on commit 8045a66

Please sign in to comment.