Skip to content

Commit

Permalink
formatting of variables with single value (fix #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed Nov 28, 2023
1 parent 004b84a commit daa8e80
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion filter_plugins/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ def nftables_format_list(cls, data: list) -> str:

@classmethod
def nftables_format_var(cls, key: str, value: (str, list)) -> str:
return f"define { cls.nftables_safe_name(key) } = {cls.nftables_format_list(value)}"
if isinstance(value, list):
return f"define {cls.nftables_safe_name(key)} = {cls.nftables_format_list(value)}"

else:
return f"define {cls.nftables_safe_name(key)} = {value}"

@classmethod
def _translate_rule(
Expand Down

0 comments on commit daa8e80

Please sign in to comment.