Add hostnames check for RMQ handler readiness

The hostnames field is filled later in the relation but templating the
context is not possible without this field. Making it mandatory to
consider RMQ Handler ready.

Change-Id: I017c4f563565503a1cc28d8db8b0b5dc406053d7
This commit is contained in:
Guillaume Boutry 2023-05-16 16:24:49 +02:00
parent 66d33806b5
commit 6eaef1e774

View File

@ -399,7 +399,9 @@ class RabbitMQHandler(RelationHandler):
def ready(self) -> bool:
"""Whether handler is ready for use."""
try:
return bool(self.interface.password)
return bool(self.interface.password) and bool(
self.interface.hostnames
)
except (AttributeError, KeyError):
return False