Skip to content

Commit

Permalink
Enhance documentation for normalization function
Browse files Browse the repository at this point in the history
  • Loading branch information
meaksh authored and dwoz committed Jul 11, 2024
1 parent f96ecd1 commit bd60c9b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions salt/states/firewalld.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,21 @@ def service(name, ports=None, protocols=None):


def _normalize_rich_rules(rich_rules):
"""
Make sure rich rules are normalized and attributes
are quoted with double quotes so it matches the output
from firewall-cmd
Example:
rule family="ipv4" source address="192.168.0.0/16" port port=22 protocol=tcp accept
rule family="ipv4" source address="192.168.0.0/16" port port='22' protocol=tcp accept
rule family='ipv4' source address='192.168.0.0/16' port port='22' protocol=tcp accept
normalized to:
rule family="ipv4" source address="192.168.0.0/16" port port="22" protocol="tcp" accept
"""
normalized_rules = []
for rich_rule in rich_rules:
normalized_rule = ""
Expand Down

0 comments on commit bd60c9b

Please sign in to comment.