Skip to content

conf/scheduler: Fix broker URL by encoding default vhost (/) to %2f

Since the move to pika to listen scheduler events, the default RabbitMQ vhost (/) needs to be percent encoded for the connection to succeed.

The following error was reported before that change:

swh-scheduler-listener_1        | ERROR:pika.adapters.blocking_connection:Error in _create_connection().
swh-scheduler-listener_1        | Traceback (most recent call last):
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 450, in _create_connection
swh-scheduler-listener_1        |     raise self._reap_last_connection_workflow_error(error)
swh-scheduler-listener_1        | pika.exceptions.ProbableAccessDeniedError: ConnectionClosedByBroker: (530) "NOT_ALLOWED - access to vhost '' refused for user 'guest'"
swh-scheduler-listener_1        | [ERROR] pika.adapters.blocking_connection -- Error in _create_connection().
swh-scheduler-listener_1        | Traceback (most recent call last):
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 450, in _create_connection
swh-scheduler-listener_1        |     raise self._reap_last_connection_workflow_error(error)
swh-scheduler-listener_1        | pika.exceptions.ProbableAccessDeniedError: ConnectionClosedByBroker: (530) "NOT_ALLOWED - access to vhost '' refused for user 'guest'"
swh-scheduler-listener_1        | Traceback (most recent call last):
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/bin/swh", line 8, in <module>
swh-scheduler-listener_1        |     sys.exit(main())
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/cli/__init__.py", line 111, in main
swh-scheduler-listener_1        |     return swh(auto_envvar_prefix='SWH')
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
swh-scheduler-listener_1        |     return self.main(*args, **kwargs)
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 782, in main
swh-scheduler-listener_1        |     rv = self.invoke(ctx)
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
swh-scheduler-listener_1        |     return _process_result(sub_ctx.command.invoke(sub_ctx))
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
swh-scheduler-listener_1        |     return _process_result(sub_ctx.command.invoke(sub_ctx))
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
swh-scheduler-listener_1        |     return ctx.invoke(self.callback, **ctx.params)
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
swh-scheduler-listener_1        |     return callback(*args, **kwargs)
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
swh-scheduler-listener_1        |     return f(get_current_context(), *args, **kwargs)
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/scheduler/cli/admin.py", line 66, in listener
swh-scheduler-listener_1        |     listener = get_listener(broker, 'celeryev.listener', scheduler_backend)
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/scheduler/celery_backend/pika_listener.py", line 25, in get_listener
swh-scheduler-listener_1        |     pika.URLParameters(broker_url)
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 359, in __init__
swh-scheduler-listener_1        |     self._impl = self._create_connection(parameters, _impl_class)
swh-scheduler-listener_1        |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/pika/adapters/blocking_connection.py", line 450, in _create_connection
swh-scheduler-listener_1        |     raise self._reap_last_connection_workflow_error(error)
swh-scheduler-listener_1        | pika.exceptions.ProbableAccessDeniedError: ConnectionClosedByBroker: (530) "NOT_ALLOWED - access to vhost '' refused for user 'guest'"

Migrated from D2998 (view on Phabricator)

Merge request reports