From fca94ae47341f09eaec8728b11fbc8bf89c76754 Mon Sep 17 00:00:00 2001 From: Tullio Sebastiani Date: Fri, 15 Dec 2023 16:14:11 +0100 Subject: [PATCH 1/2] fixed cluster shutdown issue --- kraken/shut_down/common_shut_down_func.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/kraken/shut_down/common_shut_down_func.py b/kraken/shut_down/common_shut_down_func.py index 7af446d4..5c609a15 100644 --- a/kraken/shut_down/common_shut_down_func.py +++ b/kraken/shut_down/common_shut_down_func.py @@ -135,15 +135,19 @@ def run(scenarios_list, config, wait_duration, kubecli: KrknKubernetes, telemetr scenario_telemetries: list[ScenarioTelemetry] = [] for shut_down_config in scenarios_list: - scenario_telemetry = ScenarioTelemetry() - scenario_telemetry.scenario = shut_down_config - scenario_telemetry.startTimeStamp = time.time() - telemetry.set_parameters_base64(scenario_telemetry, shut_down_config[0]) if len(shut_down_config) > 1: + config_path = shut_down_config[0] pre_action_output = post_actions.run("", shut_down_config[1]) else: + config_path = shut_down_config pre_action_output = "" - with open(shut_down_config[0], "r") as f: + + scenario_telemetry = ScenarioTelemetry() + scenario_telemetry.scenario = config_path + scenario_telemetry.startTimeStamp = time.time() + telemetry.set_parameters_base64(scenario_telemetry, config_path) + + with open(config_path, "r") as f: shut_down_config_yaml = yaml.full_load(f) shut_down_config_scenario = \ shut_down_config_yaml["cluster_shut_down_scenario"] @@ -166,8 +170,8 @@ def run(scenarios_list, config, wait_duration, kubecli: KrknKubernetes, telemetr ) except (RuntimeError, Exception): - log_exception(shut_down_config[0]) - failed_scenarios.append(shut_down_config[0]) + log_exception(config_path) + failed_scenarios.append(config_path) scenario_telemetry.exitStatus = 1 else: scenario_telemetry.exitStatus = 0 From f27eac2754e96059d4aaef4ad9c2e3c063b1761c Mon Sep 17 00:00:00 2001 From: Tullio Sebastiani Date: Fri, 15 Dec 2023 20:07:11 +0100 Subject: [PATCH 2/2] fixed config file list parsing --- kraken/shut_down/common_shut_down_func.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kraken/shut_down/common_shut_down_func.py b/kraken/shut_down/common_shut_down_func.py index 5c609a15..8eed6e89 100644 --- a/kraken/shut_down/common_shut_down_func.py +++ b/kraken/shut_down/common_shut_down_func.py @@ -135,12 +135,15 @@ def run(scenarios_list, config, wait_duration, kubecli: KrknKubernetes, telemetr scenario_telemetries: list[ScenarioTelemetry] = [] for shut_down_config in scenarios_list: - if len(shut_down_config) > 1: + config_path = shut_down_config + pre_action_output = "" + if isinstance(shut_down_config, list) : + if len(shut_down_config) == 0: + raise Exception("bad config file format for shutdown scenario") + config_path = shut_down_config[0] - pre_action_output = post_actions.run("", shut_down_config[1]) - else: - config_path = shut_down_config - pre_action_output = "" + if len(shut_down_config) > 1: + pre_action_output = post_actions.run("", shut_down_config[1]) scenario_telemetry = ScenarioTelemetry() scenario_telemetry.scenario = config_path