Skip to content

Commit

Permalink
[#633] Allow shorter path for provider url
Browse files Browse the repository at this point in the history
Problem: Snapshots' metadata being located
at `tezos-snapshots.json` path is a convention
between providers, so we should allow not to
specify it in custom provider url.

Solution: If the provided url failed, try the same url
with `tezos-snapshots.json` suffix added.
  • Loading branch information
krendelhoff2 committed Aug 31, 2023
1 parent 0eab2be commit 6c59ebb
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions baking/src/tezos_baking/tezos_setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,24 @@ def get_snapshot_link(self):
)
print()
except ValueError:
print(
color(
f"\nCouldn't collect snapshot metadata from {json_url} due to format mismatch.",
color_red,
# if user supplied an url without `tezos-snapshots.json` in the end and it failed,
# we also try that url with the `tezos-snapshots.json` added
# it's placed only for `ValueError`, because `URLError` could happen due to
# local issues, not because something is wrong with the url itself
# also, at this point we already validated, that provided url is reachable
if os.path.basename(self.config["provider_url"]) != "tezos-snapshots.json":
self.config["provider_url"] = os.path.join(
self.config["provider_url"], "tezos-snapshots.json"
)
)
print()
self.get_snapshot_link()
else:
print(
color(
f"\nCouldn't collect snapshot metadata from {json_url} due to format mismatch.",
color_red,
)
)
print()
except Exception as e:
print(f"\nUnexpected error handling snapshot metadata:\n{e}\n")

Expand Down

0 comments on commit 6c59ebb

Please sign in to comment.