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

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