Skip to content

Commit daa8e80

Browse files
committed
formatting of variables with single value (fix #1)
1 parent 004b84a commit daa8e80

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

filter_plugins/rules.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ def nftables_format_list(cls, data: list) -> str:
3737

3838
@classmethod
3939
def nftables_format_var(cls, key: str, value: (str, list)) -> str:
40-
return f"define { cls.nftables_safe_name(key) } = {cls.nftables_format_list(value)}"
40+
if isinstance(value, list):
41+
return f"define {cls.nftables_safe_name(key)} = {cls.nftables_format_list(value)}"
42+
43+
else:
44+
return f"define {cls.nftables_safe_name(key)} = {value}"
4145

4246
@classmethod
4347
def _translate_rule(

0 commit comments

Comments
 (0)