From c7068ef240f8911f3e843b305ed2c58d7a57f6d6 Mon Sep 17 00:00:00 2001 From: Krogsager Date: Mon, 15 Mar 2021 15:31:13 +0100 Subject: [PATCH] Update connection.py (#1311) Based on my headaches with silent revert to `localhost` I submit this PR. The developer should be notified if their host settings are not found. Details on the issue are here: https://github.com/celery/celery/issues/6661 --- kombu/connection.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kombu/connection.py b/kombu/connection.py index 94c43070d..47bbef66b 100644 --- a/kombu/connection.py +++ b/kombu/connection.py @@ -627,7 +627,12 @@ def _info(self, resolve=True): transport_cls, transport_cls) D = self.transport.default_connection_params - hostname = self.hostname or D.get('hostname') + if not self.hostname: + logger.warning(f"No hostname was supplied. Reverting to default '{D.get('hostname')}'") + hostname = D.get('hostname') + else: + hostname = self.hostname + if self.uri_prefix: hostname = f'{self.uri_prefix}+{hostname}'