summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrogsager <andkr@aarhus.dk>2021-03-15 15:31:13 +0100
committerGitHub <noreply@github.com>2021-03-15 16:31:13 +0200
commitc7068ef240f8911f3e843b305ed2c58d7a57f6d6 (patch)
treefc6af821f0cd514e28d11eba07ba209714d7f8d7
parent7da36e4627bac10163c7b5c255ae4dd500abda63 (diff)
downloadkombu-c7068ef240f8911f3e843b305ed2c58d7a57f6d6.tar.gz
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
-rw-r--r--kombu/connection.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/kombu/connection.py b/kombu/connection.py
index 94c43070..47bbef66 100644
--- a/kombu/connection.py
+++ b/kombu/connection.py
@@ -627,7 +627,12 @@ class Connection:
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}'