From ffb92d5fcd8734e11999ebfc30f4564744801229 Mon Sep 17 00:00:00 2001 From: henrick Date: Mon, 4 Nov 2024 20:27:11 -0500 Subject: [PATCH] Add support for user-provided default network ACL Signed-off-by: henrick --- .../zone_outage/zone_outage_scenario_plugin.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py b/krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py index c2a83ee5..ee66dfde 100644 --- a/krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py +++ b/krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py @@ -29,6 +29,8 @@ def run( subnet_ids = scenario_config["subnet_id"] duration = scenario_config["duration"] cloud_type = scenario_config["cloud_type"] + # Add support for user-provided default network ACL + default_acl_id = scenario_config.get("default_acl_id") ids = {} acl_ids_created = [] @@ -58,7 +60,15 @@ def run( "Network association ids associated with " "the subnet %s: %s" % (subnet_id, network_association_ids) ) - acl_id = cloud_object.create_default_network_acl(vpc_id) + + # Use provided default ACL if available, otherwise create a new one + if default_acl_id: + acl_id = default_acl_id + # Don't add to acl_id since we didn't create it + else: + acl_id = cloud_object.create_default_network_acl(vpc_id) + acl_ids_created.append(acl_id) + new_association_id = cloud_object.replace_network_acl_association( network_association_ids[0], acl_id ) @@ -66,7 +76,6 @@ def run( # capture the orginal_acl_id, created_acl_id and # new association_id to use during the recovery ids[new_association_id] = original_acl_id - acl_ids_created.append(acl_id) # wait for the specified duration logging.info(