Skip to content

Commit 22fcd05

Browse files
authored
configure_rabbitmq: Specifically handle VHost 404 (#241)
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.
1 parent 5dffc9a commit 22fcd05

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ History
44

55
Unreleased
66
----------
7+
* ``zocalo.configure_rabbitmq``: Show explicit error when VHost not created.
78

89
0.30.2 (2023-09-06)
910
-------------------

src/zocalo/cli/configure_rabbitmq.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,13 @@ def run():
458458
permanent_bindings.append(b)
459459
update_config(api, binding_specs, permanent_bindings)
460460
except requests.exceptions.HTTPError as e:
461+
# Specially handle the VHost error, as we used to not setup vhosts
462+
try:
463+
if e.response.json()["reason"] == "vhost_not_found":
464+
logger.error(f"Error 404: VHost not found for url: {e.response.url}")
465+
sys.exit(1)
466+
except Exception:
467+
raise
461468
logger.error(e)
462469
sys.exit(1)
463470

0 commit comments

Comments
 (0)