Skip to content

Commit

Permalink
Change is_open function's log level messages from error to debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
philipfischbacher committed Mar 12, 2024
1 parent 36cc3fd commit 041deb1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions medusa/cassandra_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,17 +819,18 @@ def is_open(host, port):
# If cassandra is not running but the host is up, host may choose to silently drop inbound connections to the
# closed port or may respond with a RST indicating that the connection was refused.
# ConnectionRefusedError: [Errno 111] Connection refused
except ConnectionRefusedError as cre:
logging.error("Host '{host}' is up, but port '{port}' is closed.".format(host=host, port=port), exc_info=cre)
except socket.error as e:
logging.error("Could not open socket to port '{port}' on '{host}'.".format(host=host, port=port), exc_info=e)
except ConnectionRefusedError:
logging.debug("Port '{port}' is closed, assuming '{host}' is down.".format(host=host, port=port))
except socket.error:
logging.debug("Could not open socket to port '{port}' on '{host}'. Assuming host is down."
.format(host=host, port=port))
finally:
try:
if s:
s.close()
except os.error as ose:
logging.warning('Socket used for Port {} check failed to close for host {}'.format(port, host),
exc_info=ose)
except os.error:
logging.debug("Socket used for Port '{port}' check failed to close for host '{host}'. Assuming host is down"
.format(host=host, port=port))
return is_accessible


Expand Down

0 comments on commit 041deb1

Please # to comment.