diff options
author | goodNETnick <33053932+goodNETnick@users.noreply.github.com> | 2022-03-31 13:48:47 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 13:48:47 +1000 |
commit | aa5b35b68c1170bfd0b9661bafa72bb10fe6ca95 (patch) | |
tree | 46f3ffc41c29666c3251f25f2f93cb1f1b9a6c60 /python/vyos/template.py | |
parent | b776003cf55e1035ac83186e44f72764e52e9e0d (diff) | |
parent | bafb1973d906707cb571385e994a949d0d90b645 (diff) | |
download | vyos-1x-aa5b35b68c1170bfd0b9661bafa72bb10fe6ca95.tar.gz vyos-1x-aa5b35b68c1170bfd0b9661bafa72bb10fe6ca95.zip |
Merge branch 'vyos:current' into ocserv_local_otp
Diffstat (limited to 'python/vyos/template.py')
-rw-r--r-- | python/vyos/template.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py index 633b28ade..dabf53692 100644 --- a/python/vyos/template.py +++ b/python/vyos/template.py @@ -127,6 +127,14 @@ def render( ################################## # Custom template filters follow # ################################## +@register_filter('force_to_list') +def force_to_list(value): + """ Convert scalars to single-item lists and leave lists untouched """ + if isinstance(value, list): + return value + else: + return [value] + @register_filter('ip_from_cidr') def ip_from_cidr(prefix): """ Take an IPv4/IPv6 CIDR host and strip cidr mask. @@ -548,6 +556,7 @@ def nft_intra_zone_action(zone_conf, ipv6=False): if 'intra_zone_filtering' in zone_conf: intra_zone = zone_conf['intra_zone_filtering'] fw_name = 'ipv6_name' if ipv6 else 'name' + name_prefix = 'NAME6_' if ipv6 else 'NAME_' if 'action' in intra_zone: if intra_zone['action'] == 'accept': @@ -555,5 +564,5 @@ def nft_intra_zone_action(zone_conf, ipv6=False): return intra_zone['action'] elif dict_search_args(intra_zone, 'firewall', fw_name): name = dict_search_args(intra_zone, 'firewall', fw_name) - return f'jump {name}' + return f'jump {name_prefix}{name}' return 'return' |