mirror of
https://github.com/krkn-chaos/krkn.git
synced 2026-02-14 18:10:00 +00:00
updating tuple type for health checks
Some checks failed
Functional & Unit Tests / Functional & Unit Tests (push) Failing after 8m58s
Functional & Unit Tests / Generate Coverage Badge (push) Has been skipped
Some checks failed
Functional & Unit Tests / Functional & Unit Tests (push) Failing after 8m58s
Functional & Unit Tests / Generate Coverage Badge (push) Has been skipped
Signed-off-by: Paige Patton <prubenda@redhat.com>
This commit is contained in:
committed by
Naga Ravi Chaitanya Elluri
parent
126f4ebb35
commit
7f0110972b
@@ -11,9 +11,9 @@ class HealthChecker:
|
||||
def __init__(self, iterations):
|
||||
self.iterations = iterations
|
||||
|
||||
def make_request(self, url, auth=None, headers=None):
|
||||
def make_request(self, url, auth=None, headers=None, verify=True):
|
||||
response_data = {}
|
||||
response = requests.get(url, auth=auth, headers=headers)
|
||||
response = requests.get(url, auth=auth, headers=headers, verify=verify)
|
||||
response_data["url"] = url
|
||||
response_data["status"] = response.status_code == 200
|
||||
response_data["status_code"] = response.status_code
|
||||
@@ -26,18 +26,20 @@ class HealthChecker:
|
||||
health_check_telemetry = []
|
||||
health_check_tracker = {}
|
||||
interval = health_check_config["interval"] if health_check_config["interval"] else 2
|
||||
|
||||
response_tracker = {config["url"]:True for config in health_check_config["config"]}
|
||||
while self.current_iterations < self.iterations:
|
||||
for config in health_check_config.get("config"):
|
||||
auth, headers = None, None
|
||||
verify_url = config["verify_url"] if "verify_url" in config else True
|
||||
if config["url"]: url = config["url"]
|
||||
|
||||
if config["bearer_token"]:
|
||||
bearer_token = "Bearer " + config["bearer_token"]
|
||||
headers = {"Authorization": bearer_token}
|
||||
|
||||
if config["auth"]: auth = config["auth"]
|
||||
response = self.make_request(url, auth, headers)
|
||||
if config["auth"]: auth = tuple(config["auth"].split(','))
|
||||
response = self.make_request(url, auth, headers, verify_url)
|
||||
|
||||
if response["status_code"] != 200:
|
||||
if config["url"] not in health_check_tracker:
|
||||
|
||||
Reference in New Issue
Block a user