Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added authentication support for AQMP broker url #8057

Merged
merged 15 commits into from
Sep 20, 2021
1 change: 1 addition & 0 deletions CHANGELOG.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3924,3 +3924,4 @@ Regression: changes from `1.2.12` were missing from `1.4.0`, readded them

* utterance templates defined in actions are checked for existence upon training a new agent, and a warning
is thrown before training if one is missing
* added authentication support for rabbitmq url which was missing before
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't usually change old changelog entries — the new one needs to be added instead. This guide contains the detailed information about the process: https://github.com/RasaHQ/rasa/blob/main/changelog/README.md

But to keep it short: could you please create a 8057.improvement.md file inside a changelog directory with all the information about what was done in this PR instead of modifying CHANGELOG.mdx?

Copy link
Contributor Author

@nakshathru nakshathru Aug 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alwx Sounds good!! removed change log entry and created new one as per your suggestion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

5 changes: 4 additions & 1 deletion rasa/core/brokers/pika.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from asyncio import AbstractEventLoop
from collections import deque
from typing import Deque, Dict, Optional, Text, Union, Any, List, Tuple
from urllib.parse import urlparse

import aio_pika

Expand Down Expand Up @@ -168,7 +169,9 @@ async def _connect(self) -> aio_pika.RobustConnection:
# The `url` parameter will take precedence over parameters like `login` or
# `password`.
if self.host.startswith("amqp"):
url = self.host

host_ob = urlparse(self.host)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the name host_ob mean in this context? Can there be a better name for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alwx
I almost lost hope of you reviewing this PR after 6 months!!!!
Thanks for the update.
I renamed host_ob to parsed_host, does that make sense for you?
This object is just for holding the parsed url components values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds better now, thanks!

url = f"{host_ob.scheme}://{self.username}:{self.password}@{host_ob.netloc}:{self.port}"

ssl_options = _create_rabbitmq_ssl_options(self.host)
logger.info("Connecting to RabbitMQ ...")
Expand Down