Skip to content

Commit

Permalink
T7147: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sskaje committed Feb 9, 2025
1 parent 460bce0 commit 3879724
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions python/vyos/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,9 @@ def add_includes(group, key):
if not is_ip_network(item):
continue

if (group_name == 'network-group' and is_ipv4(item)) or \
(group_name == 'ipv6-network-group' and is_ipv6(item)):
if (group_name == 'network-group' and is_ipv4(item)) or (
group_name == 'ipv6-network-group' and is_ipv6(item)
):
out_list.append(item)

elif key in group:
Expand Down
17 changes: 11 additions & 6 deletions src/helpers/firewall-group-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@
from vyos.configquery import ConfigTreeQuery
from vyos.firewall import firewall_group_update


def get_config(config=None):
if config:
conf = config
else:
conf = ConfigTreeQuery()

config = conf.get_config_dict([], key_mangling=('-', '_'), get_first_key=True,
no_tag_node_value_mangle=True)
config = conf.get_config_dict(
[], key_mangling=('-', '_'), get_first_key=True, no_tag_node_value_mangle=True
)

firewall_group = conf.get_config_dict(
['firewall', 'group'],
key_mangling=('-', '_'),
get_first_key=True,
no_tag_node_value_mangle=True
)

firewall_group = conf.get_config_dict(['firewall', 'group'], key_mangling=('-', '_'),
get_first_key=True,
no_tag_node_value_mangle=True)
if 'nat' in config:
config['nat']['firewall_group'] = firewall_group

Expand All @@ -41,7 +47,6 @@ def get_config(config=None):


if __name__ == '__main__':

config = get_config()

if not firewall_group_update(config):
Expand Down

0 comments on commit 3879724

Please sign in to comment.