From 15989f86b18c99d79b342e78a2c3bd26c4973868 Mon Sep 17 00:00:00 2001 From: Vladislav Grigoryev <20725816+vgaetera@users.noreply.github.com> Date: Tue, 23 Jun 2020 13:34:40 +0300 Subject: [PATCH 38/45] fix(cli): unify indentation for forward-ports and rich rules Unify indentation for forward-ports and rich rules in the CLI zone listing. Do not insert redundant newlines when there are no forward-ports or rich rules. (cherry picked from commit 41df4088cd98f35adb3ac836143e7be34bb07a21) (cherry picked from commit 809fc4b61321cd459dde65559af3dfbd73f4ce1e) --- src/firewall/command.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/firewall/command.py b/src/firewall/command.py index c371dc23584c..8dee63bdda8f 100644 --- a/src/firewall/command.py +++ b/src/firewall/command.py @@ -428,7 +428,7 @@ class FirewallCommand(object): for port in ports])) self.print_msg(" protocols: " + " ".join(sorted(protocols))) self.print_msg(" masquerade: %s" % ("yes" if masquerade else "no")) - self.print_msg(" forward-ports: " + + self.print_msg(" forward-ports: " + ("\n\t" if forward_ports else "") + "\n\t".join(["port=%s:proto=%s:toport=%s:toaddr=%s" % \ (port, proto, toport, toaddr) for (port, proto, toport, toaddr) in \ @@ -437,8 +437,8 @@ class FirewallCommand(object): " ".join(["%s/%s" % (port[0], port[1]) for port in source_ports])) self.print_msg(" icmp-blocks: " + " ".join(icmp_blocks)) - self.print_msg(" rich rules: \n\t" + "\n\t".join( - sorted(rules, key=rich_rule_sorted_key))) + self.print_msg(" rich rules: " + ("\n\t" if rules else "") + + "\n\t".join(sorted(rules, key=rich_rule_sorted_key))) def print_service_info(self, service, settings): ports = settings.getPorts() -- 2.27.0