Skip to content

Commit

Permalink
configure_rabbitmq: Specifically handle VHost 404 (#241)
Browse files Browse the repository at this point in the history
Our current configuration doesn't actually specify vhost, so if you are
trying to configure a fresh RabbitMQ then you will get apparently
mysterious failures.
  • Loading branch information
ndevenish authored Sep 6, 2023
1 parent 5dffc9a commit 22fcd05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ History

Unreleased
----------
* ``zocalo.configure_rabbitmq``: Show explicit error when VHost not created.

0.30.2 (2023-09-06)
-------------------
Expand Down
7 changes: 7 additions & 0 deletions src/zocalo/cli/configure_rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,13 @@ def run():
permanent_bindings.append(b)
update_config(api, binding_specs, permanent_bindings)
except requests.exceptions.HTTPError as e:
# Specially handle the VHost error, as we used to not setup vhosts
try:
if e.response.json()["reason"] == "vhost_not_found":
logger.error(f"Error 404: VHost not found for url: {e.response.url}")
sys.exit(1)
except Exception:
raise
logger.error(e)
sys.exit(1)

Expand Down

0 comments on commit 22fcd05

Please sign in to comment.