From 47d9109d0d49c897e2aaf66c107c0b1f9febc86d Mon Sep 17 00:00:00 2001 From: JeffWDH Date: Fri, 29 Sep 2023 04:13:17 -0400 Subject: T5497: Add ability to resequence rule numbers for firewall (cherry picked from commit 5180622cd6c928812a644f427d65acae763c37cc) --- src/op_mode/generate_firewall_rule-resequence.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/op_mode/generate_firewall_rule-resequence.py b/src/op_mode/generate_firewall_rule-resequence.py index b5b625a80..4362b484a 100755 --- a/src/op_mode/generate_firewall_rule-resequence.py +++ b/src/op_mode/generate_firewall_rule-resequence.py @@ -116,9 +116,18 @@ if __name__ == "__main__": print('Firewall is not configured') exit(1) - #config_dict = config.get_config_dict('firewall') config_dict = config.get_config_dict('firewall') + # Remove global-options, group and flowtable as they don't need sequencing + if 'global-options' in config_dict['firewall']: + del config_dict['firewall']['global-options'] + + if 'group' in config_dict['firewall']: + del config_dict['firewall']['group'] + + if 'flowtable' in config_dict['firewall']: + del config_dict['firewall']['flowtable'] + # Convert rule keys to integers, rule "10" -> rule 10 # This is necessary for sorting the rules config_dict = convert_rule_keys_to_int(config_dict) -- cgit v1.2.3 From 438eb7ad6a9edcf2ced3ac08595dace20d861909 Mon Sep 17 00:00:00 2001 From: JeffWDH Date: Fri, 29 Sep 2023 08:32:51 -0400 Subject: T5497: Add ability to resequence rule numbers for firewall Updated spacing. (cherry picked from commit f39a35338ac967381356f8b9b499ec1d730653fc) --- src/op_mode/generate_firewall_rule-resequence.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/op_mode/generate_firewall_rule-resequence.py b/src/op_mode/generate_firewall_rule-resequence.py index 4362b484a..eb82a1a0a 100755 --- a/src/op_mode/generate_firewall_rule-resequence.py +++ b/src/op_mode/generate_firewall_rule-resequence.py @@ -120,13 +120,13 @@ if __name__ == "__main__": # Remove global-options, group and flowtable as they don't need sequencing if 'global-options' in config_dict['firewall']: - del config_dict['firewall']['global-options'] + del config_dict['firewall']['global-options'] if 'group' in config_dict['firewall']: - del config_dict['firewall']['group'] + del config_dict['firewall']['group'] if 'flowtable' in config_dict['firewall']: - del config_dict['firewall']['flowtable'] + del config_dict['firewall']['flowtable'] # Convert rule keys to integers, rule "10" -> rule 10 # This is necessary for sorting the rules -- cgit v1.2.3