4.5.0 policy-handler - multi change
DCAEGEN2-853:
- stop reporting the absence of policies or updates
as error - this is an expected result == INFO or WARNING
DCAEGEN2-903: preparation for TLS on the web-server of policy-handler
DCAEGEN2-930:
- configurable timeouts for http requests from policy-handler
- added configurable pinging on the web-socket to PDP
- added healthcheck info on the web-socket
- upgraded websocket-client lib to 0.53.0
DCAEGEN2-1017: fixed a bug on policy-filter matching
by filter_config_name
- refactored and enhanced the unit-tests
Change-Id: I111ddc57bb978554ef376cbf916965b6667dad9b
Signed-off-by: Alex Shatov <alexs@att.com>
Issue-ID: DCAEGEN2-853
Issue-ID: DCAEGEN2-903
Issue-ID: DCAEGEN2-930
Issue-ID: DCAEGEN2-1017
diff --git a/policyhandler/discovery.py b/policyhandler/discovery.py
index 5a35525..4c5b64e 100644
--- a/policyhandler/discovery.py
+++ b/policyhandler/discovery.py
@@ -56,7 +56,7 @@
@staticmethod
def _discover_service(audit, service_name, service_path):
"""find the service record in consul"""
- response = requests.get(service_path)
+ response = requests.get(service_path, timeout=Config.consul_timeout_in_secs)
DiscoveryClient._logger.info(audit.info("response {} from {}: {}".format(
response.status_code, service_path, response.text)))
@@ -113,7 +113,7 @@
@staticmethod
def _get_value_from_kv(url):
"""get the value from consul-kv at discovery url"""
- response = requests.get(url)
+ response = requests.get(url, timeout=Config.consul_timeout_in_secs)
response.raise_for_status()
data = response.json()
value = base64.b64decode(data[0]["Value"]).decode("utf-8")
@@ -129,6 +129,7 @@
log_line = "get from {} at {}".format(DiscoveryClient.CONSUL_ENTITY, discovery_url)
DiscoveryClient._logger.info(metrics.metrics_start(log_line))
+ status_code = None
try:
status_code, value = DiscoveryClient._get_value_from_kv(discovery_url)
except Exception as ex: