Log connection error details per-host

Otherwise, you don't get much insight into why you had to settle for
your third configured host. Now, you can get information like

   An error occurred while connecting to appliance foo.bar:
      [Errno -5] No address associated with hostname
   An error occurred while connecting to appliance localhost:
      [Errno 111] Connection refused

even when we ultimately succeed in creating a client.
This commit is contained in:
Tim Burke 2018-06-22 11:59:35 -07:00
parent eb2fee80e8
commit 6306846b45
1 changed files with 1 additions and 1 deletions

View File

@ -224,7 +224,7 @@ class KMIPProxy:
self.socket.connect((self.host, self.port))
except Exception as e:
self.logger.error("An error occurred while connecting to "
"appliance " + self.host)
"appliance %s: %s", self.host, e)
self.socket.close()
last_error = e
else: