From 72c95ec1df8ad7be8a715b3338001349684cafa9 Mon Sep 17 00:00:00 2001 From: Nicolas Fort Date: Fri, 10 May 2024 13:28:03 +0000 Subject: T6329: firewall: add a patch for op-mode command --- src/op_mode/firewall.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/op_mode/firewall.py b/src/op_mode/firewall.py index 442c186cc..3f8ba6fa1 100755 --- a/src/op_mode/firewall.py +++ b/src/op_mode/firewall.py @@ -531,9 +531,15 @@ def show_firewall_group(name=None): continue for idx, member in enumerate(members): - val = member.get('val', 'N/D') - timeout = str(member.get('timeout', 'N/D')) - expires = str(member.get('expires', 'N/D')) + if type(member) == str: + # Only member, and no timeout: + val = member + timeout = "N/D" + expires = "N/D" + else: + val = member.get('val', 'N/D') + timeout = str(member.get('timeout', 'N/D')) + expires = str(member.get('expires', 'N/D')) if args.detail: row.append(f'{val} (timeout: {timeout}, expires: {expires})') -- cgit v1.2.3 From b705adc40b761e338026b938d80398fdb281a197 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sun, 12 May 2024 08:56:54 +0200 Subject: T6329: firewall: use isinstance() in op-mode script --- src/op_mode/firewall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/op_mode/firewall.py b/src/op_mode/firewall.py index 3f8ba6fa1..15fbb65a2 100755 --- a/src/op_mode/firewall.py +++ b/src/op_mode/firewall.py @@ -531,7 +531,7 @@ def show_firewall_group(name=None): continue for idx, member in enumerate(members): - if type(member) == str: + if isinstance(member, str): # Only member, and no timeout: val = member timeout = "N/D" -- cgit v1.2.3