Blame SOURCES/0002-fix-CLI-service-also-output-helpers-for-service-info.patch

40251c
From ff17d85fd863e7be2b4088c92360185aca6693b0 Mon Sep 17 00:00:00 2001
40251c
From: Eric Garver <eric@garver.life>
40251c
Date: Thu, 7 Nov 2019 08:21:52 -0500
40251c
Subject: [PATCH] fix: CLI: service: also output helpers for service info
40251c
40251c
Fixes: 0c07b704f76d ("feat: CLI: add "helper" support for services")
40251c
Fixes: rhbz 1769520
40251c
(cherry picked from commit 6bfffe65f55b727afc37a8c1fb4068f6589bb890)
40251c
---
40251c
 src/firewall/command.py               |  2 ++
40251c
 src/tests/features/helpers_custom.at  | 42 ++++++++++++++++++++++++++-
40251c
 src/tests/features/service_include.at |  3 ++
40251c
 3 files changed, 46 insertions(+), 1 deletion(-)
40251c
40251c
diff --git a/src/firewall/command.py b/src/firewall/command.py
40251c
index 85e58d731a80..c371dc23584c 100644
40251c
--- a/src/firewall/command.py
40251c
+++ b/src/firewall/command.py
40251c
@@ -449,6 +449,7 @@ class FirewallCommand(object):
40251c
         destinations = settings.getDestinations()
40251c
         short_description = settings.getShort()
40251c
         includes = settings.getIncludes()
40251c
+        helpers = settings.getHelpers()
40251c
         self.print_msg(service)
40251c
         if self.verbose:
40251c
             self.print_msg("  summary: " + short_description)
40251c
@@ -464,6 +465,7 @@ class FirewallCommand(object):
40251c
                        " ".join(["%s:%s" % (k, v)
40251c
                                  for k, v in destinations.items()]))
40251c
         self.print_msg("  includes: " + " ".join(sorted(includes)))
40251c
+        self.print_msg("  helpers: " + " ".join(sorted(helpers)))
40251c
 
40251c
     def print_icmptype_info(self, icmptype, settings):
40251c
         destinations = settings.getDestinations()
40251c
diff --git a/src/tests/features/helpers_custom.at b/src/tests/features/helpers_custom.at
40251c
index c65f067a06ec..4c9024d1e2b8 100644
40251c
--- a/src/tests/features/helpers_custom.at
40251c
+++ b/src/tests/features/helpers_custom.at
40251c
@@ -1,5 +1,5 @@
40251c
 FWD_START_TEST([customer helpers])
40251c
-AT_KEYWORDS(helpers rhbz1733066 gh514)
40251c
+AT_KEYWORDS(helpers rhbz1733066 gh514 rhbz1769520)
40251c
 
40251c
 FWD_CHECK([-q --permanent --new-helper="ftptest" --module="nf_conntrack_ftp"])
40251c
 FWD_CHECK([-q --permanent --helper=ftptest --add-port="2121/tcp"])
40251c
@@ -8,7 +8,27 @@ FWD_CHECK([-q --permanent --new-service="ftptest"])
40251c
 FWD_CHECK([-q --permanent --service=ftptest --add-module="ftptest"])
40251c
 FWD_CHECK([-q --permanent --service=ftptest --query-module="ftptest"])
40251c
 FWD_CHECK([-q --permanent --service=ftptest --add-port="2121/tcp"])
40251c
+FWD_CHECK([--permanent --info-service=ftptest | TRIM_WHITESPACE], 0, [m4_strip([dnl
40251c
+ftptest
40251c
+  ports: 2121/tcp
40251c
+  protocols:
40251c
+  source-ports:
40251c
+  modules: ftptest
40251c
+  destination:
40251c
+  includes:
40251c
+  helpers:
40251c
+])])
40251c
 FWD_RELOAD
40251c
+FWD_CHECK([--info-service=ftptest | TRIM_WHITESPACE], 0, [m4_strip([dnl
40251c
+ftptest
40251c
+  ports: 2121/tcp
40251c
+  protocols:
40251c
+  source-ports:
40251c
+  modules: ftptest
40251c
+  destination:
40251c
+  includes:
40251c
+  helpers:
40251c
+])])
40251c
 
40251c
 FWD_CHECK([-q --add-service=ftptest])
40251c
 
40251c
@@ -42,7 +62,27 @@ dnl Same thing as above, but with the new "helper" in service.
40251c
 FWD_CHECK([-q --permanent --service=ftptest --remove-module="ftptest"])
40251c
 FWD_CHECK([-q --permanent --service=ftptest --query-module="ftptest"], 1)
40251c
 FWD_CHECK([-q --permanent --service=ftptest --add-helper="ftptest"])
40251c
+FWD_CHECK([--permanent --info-service=ftptest | TRIM_WHITESPACE], 0, [m4_strip([dnl
40251c
+ftptest
40251c
+  ports: 2121/tcp
40251c
+  protocols:
40251c
+  source-ports:
40251c
+  modules:
40251c
+  destination:
40251c
+  includes:
40251c
+  helpers: ftptest
40251c
+])])
40251c
 FWD_RELOAD
40251c
+FWD_CHECK([--info-service=ftptest | TRIM_WHITESPACE], 0, [m4_strip([dnl
40251c
+ftptest
40251c
+  ports: 2121/tcp
40251c
+  protocols:
40251c
+  source-ports:
40251c
+  modules:
40251c
+  destination:
40251c
+  includes:
40251c
+  helpers: ftptest
40251c
+])])
40251c
 
40251c
 FWD_CHECK([-q --add-service=ftptest])
40251c
 
40251c
diff --git a/src/tests/features/service_include.at b/src/tests/features/service_include.at
40251c
index 219d5b42767b..7f02701a9419 100644
40251c
--- a/src/tests/features/service_include.at
40251c
+++ b/src/tests/features/service_include.at
40251c
@@ -76,6 +76,7 @@ my-service-with-include
40251c
   modules:
40251c
   destination:
40251c
   includes: mdns recursive-service ssdp
40251c
+  helpers:
40251c
 ])])
40251c
 FWD_CHECK([--info-service=my-service-with-include | TRIM_WHITESPACE], 0, [m4_strip([dnl
40251c
 my-service-with-include
40251c
@@ -85,6 +86,7 @@ my-service-with-include
40251c
   modules:
40251c
   destination:
40251c
   includes: mdns recursive-service ssdp
40251c
+  helpers:
40251c
 ])])
40251c
 
40251c
 dnl firewall-offline-cmd
40251c
@@ -106,6 +108,7 @@ my-service-with-include
40251c
   modules:
40251c
   destination:
40251c
   includes: mdns recursive-service ssdp
40251c
+  helpers:
40251c
 ])])
40251c
 
40251c
 dnl negative test for including service that doesn't exist
40251c
-- 
40251c
2.23.0
40251c