Skip to content

Commit ffb92d5

Browse files
author
henrick
committed
Add support for user-provided default network ACL
Signed-off-by: henrick <[email protected]>
1 parent 9597662 commit ffb92d5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

krkn/scenario_plugins/zone_outage/zone_outage_scenario_plugin.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def run(
2929
subnet_ids = scenario_config["subnet_id"]
3030
duration = scenario_config["duration"]
3131
cloud_type = scenario_config["cloud_type"]
32+
# Add support for user-provided default network ACL
33+
default_acl_id = scenario_config.get("default_acl_id")
3234
ids = {}
3335
acl_ids_created = []
3436

@@ -58,15 +60,22 @@ def run(
5860
"Network association ids associated with "
5961
"the subnet %s: %s" % (subnet_id, network_association_ids)
6062
)
61-
acl_id = cloud_object.create_default_network_acl(vpc_id)
63+
64+
# Use provided default ACL if available, otherwise create a new one
65+
if default_acl_id:
66+
acl_id = default_acl_id
67+
# Don't add to acl_id since we didn't create it
68+
else:
69+
acl_id = cloud_object.create_default_network_acl(vpc_id)
70+
acl_ids_created.append(acl_id)
71+
6272
new_association_id = cloud_object.replace_network_acl_association(
6373
network_association_ids[0], acl_id
6474
)
6575

6676
# capture the orginal_acl_id, created_acl_id and
6777
# new association_id to use during the recovery
6878
ids[new_association_id] = original_acl_id
69-
acl_ids_created.append(acl_id)
7079

7180
# wait for the specified duration
7281
logging.info(

0 commit comments

Comments
 (0)