Change-Id: I41c5992edb9f1c232fb7cd5d1b66153e2d403b3b
Signed-off-by: David Garcia <david.garcia@canonical.com>
port_in_use = False
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
- if s.connect_ex(("kafka", int(config.conf["message"].get("port")))) == 0:
+ if (
+ s.connect_ex(
+ (
+ config.conf.get("message", {}).get("host", "kafka"),
+ int(config.conf["message"].get("port")),
+ )
+ )
+ == 0
+ ):
port_in_use = True
except Exception as e:
logging.info("Error when trying to get kafka status.")