diff options
author | l0crian1 <ryan.claridge13@gmail.com> | 2024-04-01 11:32:32 -0400 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-04-06 09:57:25 +0000 |
commit | 9a682c0a4116785f9611f7804f35c28db8fea2b5 (patch) | |
tree | 018fa761332539a6d2316f49bd86788919e85a33 /src/op_mode | |
parent | 484d5ab1fce46c70ec70cf09099e13d31b094f6e (diff) | |
download | vyos-1x-9a682c0a4116785f9611f7804f35c28db8fea2b5.tar.gz vyos-1x-9a682c0a4116785f9611f7804f35c28db8fea2b5.zip |
T6188:
- modified: src/op_mode/firewall.py
Changed behavior of "show firewall" for specific rule to only show rule and not also default-action
(cherry picked from commit a7c5205ab12e767c6c60887033694c597e01f21b)
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/firewall.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/op_mode/firewall.py b/src/op_mode/firewall.py index b7c3d87c2..26f3a5156 100755 --- a/src/op_mode/firewall.py +++ b/src/op_mode/firewall.py @@ -90,9 +90,6 @@ def get_nftables_details(family, hook, priority): return out def output_firewall_vertical(rules, headers): - if args.rule: - rules.pop() - for rule in rules: adjusted_rule = rule + [""] * (len(headers) - len(rule)) # account for different header length, like default-action transformed_rule = [[header, textwrap.fill(adjusted_rule[i].replace('\n', ' '), 100)] for i, header in enumerate(headers)] # create key-pair list from headers and rules lists; wrap at 100 char @@ -134,6 +131,9 @@ def output_firewall_name(family, hook, priority, firewall_conf, single_rule_id=N rows.append(row) if rows: + if args.rule: + rows.pop() + header = ['Rule', 'Description', 'Action', 'Protocol', 'Packets', 'Bytes', 'Conditions'] if args.detail: output_firewall_vertical(rows, header) |