From 0445f9ea3938237323b498e4b86ede6936533140 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 10 Oct 2023 20:51:30 +0100 Subject: [PATCH] Improve error message Signed-off-by: Pedro Algarvio --- salt/transport/tcp.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/salt/transport/tcp.py b/salt/transport/tcp.py index 3cf464b222c..2efc1a502a3 100644 --- a/salt/transport/tcp.py +++ b/salt/transport/tcp.py @@ -308,12 +308,14 @@ class TCPPubClient(salt.transport.base.PublishClient): self.unpacker = salt.utils.msgpack.Unpacker() log.debug("PubClient conencted to %r %r", self, self.path) except Exception as exc: # pylint: disable=broad-except + if self.path: + _connect_to = self.path + else: + _connect_to = f"{self.host}:{self.port}" log.warning( "TCP Publish Client encountered an exception while connecting to" - " %s:%s %s: %r, will reconnect in %d seconds", - self.host, - self.port, - self.path, + " %s: %r, will reconnect in %d seconds", + _connect_to, exc, self.backoff, )