Skip to content

Commit 87aca68

Browse files
committed
Fix lint errors
1 parent 44a407b commit 87aca68

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

netsim/providers/clab.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,21 @@ def remove_ipv6_forwarding_rule( brname: str ) -> bool:
6767
log.print_verbose( f"remove_ipv6_forwarding_rule failed to list rules for Linux bridge '{brname}'" )
6868
return False
6969
try:
70-
result = json.loads(status)
71-
for rule in result['nftables']:
72-
if 'rule' in rule and rule["rule"]["expr"][0]["match"]["right"]==brname:
73-
handle = rule["rule"]["handle"]
74-
status = external_commands.run_command(
75-
['sudo','nft',f'destroy rule ip6 filter DOCKER-USER handle {handle}'],
76-
check_result=True,return_stdout=True)
77-
log.print_verbose(f"Remove ipv6 nftables rule for Linux bridge '{brname}': {status}")
78-
return status
79-
log.print_verbose( f"remove_ipv6_forwarding_rule did not find any rules for '{brname}'" )
80-
return True
70+
if isinstance(status,str):
71+
result = json.loads(status)
72+
for rule in result['nftables']:
73+
if 'rule' in rule and rule["rule"]["expr"][0]["match"]["right"]==brname:
74+
handle = rule["rule"]["handle"]
75+
status = external_commands.run_command(
76+
['sudo','nft',f'destroy rule ip6 filter DOCKER-USER handle {handle}'],
77+
check_result=True,return_stdout=True)
78+
log.print_verbose(f"Remove ipv6 nftables rule for Linux bridge '{brname}': {status}")
79+
return status is not False
80+
log.print_verbose( f"remove_ipv6_forwarding_rule did not find any rules for '{brname}'" )
81+
return True
8182
except Exception as ex:
8283
log.print_verbose(ex)
83-
return False
84+
return False
8485

8586
def create_ovs_bridge( brname: str ) -> bool:
8687
status = external_commands.run_command(

0 commit comments

Comments
 (0)