From c4781aa615ea63aa17763ae1331deada501ee116 Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Tue, 5 Jul 2022 17:26:24 +0200 Subject: [PATCH] refactor(xml): Shorten section name var --- update-firewall-source.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/update-firewall-source.py b/update-firewall-source.py index 0be4fbe..14c7005 100644 --- a/update-firewall-source.py +++ b/update-firewall-source.py @@ -285,7 +285,7 @@ def add_rule_elem( prio: int, target: str, /, *, - arg_section_name: str = None, + arg_section: str = None, arg_proto: str = None, arg_state: str = None, arg_ports: list = None, @@ -307,8 +307,7 @@ def add_rule_elem( f"""{"--match multiport --destination-ports " + ",".join(arg_ports) + " " if arg_ports else ""}""" \ f"""{"--source " + arg_address + " " if arg_address else ""}""" \ f"""--jump {target}""" \ - f""" - {" --match comment --comment " + chr(34) + arg_section_name[:256] + chr(34) if arg_section_name else ""}""" + f"""{" --match comment --comment " + chr(34) + arg_section[:256] + chr(34) if arg_section else ""}""" except lxml.etree.LxmlError as le: log.error(f"""Failed to add XML ''\n""" f"Verbatim exception was:\n" @@ -382,7 +381,7 @@ def add_fw_rule_to_xml( address_family, rules_already_added[address_family], target, - arg_section_name=section_name, + arg_section=section_name, arg_proto=proto, arg_state=config_obj.get(section_name, "state"), arg_ports=ports, @@ -398,7 +397,7 @@ def add_fw_rule_to_xml( address_family, rules_already_added[address_family], target, - arg_section_name=section_name, + arg_section=section_name, arg_proto=proto, arg_state=config_obj.get(section_name, "state"), arg_ports=ports)