Blame SOURCES/0038-fix-cli-unify-indentation-for-forward-ports-and-rich.patch

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