From 97035a765cfa3209def1bde5708a7a4a04fd9a96 Mon Sep 17 00:00:00 2001 From: Paige Patton Date: Thu, 21 Nov 2024 14:33:57 -0500 Subject: [PATCH] adding get node name list changes Signed-off-by: Paige Patton --- .../network_chaos_scenario_plugin.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/krkn/scenario_plugins/network_chaos/network_chaos_scenario_plugin.py b/krkn/scenario_plugins/network_chaos/network_chaos_scenario_plugin.py index eaa0719f..7265b756 100644 --- a/krkn/scenario_plugins/network_chaos/network_chaos_scenario_plugin.py +++ b/krkn/scenario_plugins/network_chaos/network_chaos_scenario_plugin.py @@ -42,19 +42,13 @@ def run( test_egress = get_yaml_item_value( test_dict, "egress", {"bandwidth": "100mbit"} ) + if test_node: node_name_list = test_node.split(",") + nodelst = common_node_functions.get_node_by_name(node_name_list, lib_telemetry.get_lib_kubernetes()) else: - node_name_list = [test_node] - nodelst = [] - for single_node_name in node_name_list: - nodelst.extend( - common_node_functions.get_node( - single_node_name, - test_node_label, - test_instance_count, - lib_telemetry.get_lib_kubernetes(), - ) + nodelst = common_node_functions.get_node( + test_node_label, test_instance_count, lib_telemetry.get_lib_kubernetes() ) file_loader = FileSystemLoader( os.path.abspath(os.path.dirname(__file__)) @@ -149,7 +143,10 @@ def run( finally: logging.info("Deleting jobs") self.delete_job(joblst[:], lib_telemetry.get_lib_kubernetes()) - except (RuntimeError, Exception): + except (RuntimeError, Exception) as e: + logging.error( + "NetworkChaosScenarioPlugin exiting due to Exception %s" % e + ) scenario_telemetry.exit_status = 1 return 1 else: