From 5ba9c03e23bb31d77a80c96cf49126432b427b42 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 26 Jun 2023 10:15:03 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20print=20empty=20element=20lists?= =?UTF-8?q?=20in=20nftables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because nft chokes on them. --- web/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/system.py b/web/system.py index 455b913..2411f10 100644 --- a/web/system.py +++ b/web/system.py @@ -81,7 +81,7 @@ def save_config(): return f'''\ set {name} {{ type {"ipv6_addr" if name.endswith('/6') else "ipv4_addr"}; flags interval - elements = {{ {', '.join(ips)} }} + {"" if ips else "# "}elements = {{ {", ".join(ips)} }} }}''' for name, ips in ipsets.items(): print(format_set(name, ips), file=f)