Skip to content

Commit

Permalink
edge case if a release doesn't have a whl file in it
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Nov 16, 2023
1 parent 1d8e9ce commit 80c6b52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pioreactor/cli/pio.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,14 @@ def update_app(
raise HTTPException(
f"Unable to retrieve information over internet. Is the Pioreactor connected to the internet? LAP is {is_using_local_access_point()}."
)

response = get(f"https://api.github.com/repos/{repo}/releases/{tag}")
if response.raise_for_status():
logger.error(f"Version {version} not found")
raise click.Abort()

release_metadata = loads(response.body)
version_installed = release_metadata["tag_name"]
found_whl = False
for asset in release_metadata["assets"]:
# add the following files to the release. They should ideally be idempotent!

Expand All @@ -561,6 +561,7 @@ def update_app(
]
)
elif asset_name.startswith("pioreactor") and asset_name.endswith(".whl"):
found_whl = True
assert (
version_installed in url
), f"Hm, pip installing {url} but this doesn't match version specified for installing: {version_installed}"
Expand All @@ -586,6 +587,8 @@ def update_app(
("sudo bash /tmp/post_update.sh", 100),
]
)
if not found_whl:
raise FileNotFoundError(f"Could not find a whl file in the {repo=} {tag=} release.")

for command, _ in sorted(commands_and_priority, key=lambda t: t[1]):
logger.debug(command)
Expand Down

0 comments on commit 80c6b52

Please sign in to comment.