|
|
460745 |
From 647e23eb307e09597f355fb10abfd4c74a4b6f84 Mon Sep 17 00:00:00 2001
|
|
|
460745 |
From: Petr Vobornik <pvoborni@redhat.com>
|
|
|
460745 |
Date: Thu, 3 Aug 2017 16:03:29 +0200
|
|
|
460745 |
Subject: [PATCH] log progress of wait_for_open_ports
|
|
|
460745 |
|
|
|
460745 |
To know what to focus on when some check fail. E.g. to detect that
|
|
|
460745 |
IPv6 address or its resolution for localhost is misconfigured.
|
|
|
460745 |
|
|
|
460745 |
https://pagure.io/freeipa/issue/7083
|
|
|
460745 |
|
|
|
460745 |
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
|
|
|
460745 |
---
|
|
|
460745 |
ipapython/ipautil.py | 7 ++++++-
|
|
|
460745 |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
460745 |
|
|
|
460745 |
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
|
|
|
460745 |
index e1e6e32b15559486caecb070627db82e14a57bdf..59ea84da4ac667a39bdaa9a6fd7d87ab1b6e658d 100644
|
|
|
460745 |
--- a/ipapython/ipautil.py
|
|
|
460745 |
+++ b/ipapython/ipautil.py
|
|
|
460745 |
@@ -1213,15 +1213,20 @@ def wait_for_open_ports(host, ports, timeout=0):
|
|
|
460745 |
op_timeout = time.time() + timeout
|
|
|
460745 |
|
|
|
460745 |
for port in ports:
|
|
|
460745 |
+ root_logger.debug('waiting for port: %s', port)
|
|
|
460745 |
+ log_error = True
|
|
|
460745 |
while True:
|
|
|
460745 |
- port_open = host_port_open(host, port)
|
|
|
460745 |
+ port_open = host_port_open(host, port, log_errors=log_error)
|
|
|
460745 |
+ log_error = False # Log only first err so that the log is readable
|
|
|
460745 |
|
|
|
460745 |
if port_open:
|
|
|
460745 |
+ root_logger.debug('SUCCESS: port: %s', port)
|
|
|
460745 |
break
|
|
|
460745 |
if timeout and time.time() > op_timeout: # timeout exceeded
|
|
|
460745 |
raise socket.timeout("Timeout exceeded")
|
|
|
460745 |
time.sleep(1)
|
|
|
460745 |
|
|
|
460745 |
+
|
|
|
460745 |
def wait_for_open_socket(socket_name, timeout=0):
|
|
|
460745 |
"""
|
|
|
460745 |
Wait until the specified socket on the local host is open. Timeout
|
|
|
460745 |
--
|
|
|
460745 |
2.13.5
|
|
|
460745 |
|