AMBARI-14757 host check doesn't show warning about working firewall on the host (Suse only) (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3c455299 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3c455299 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3c455299 Branch: refs/heads/branch-dev-patch-upgrade Commit: 3c455299d4a189ac27ea3c1473b6a38ff1192c39 Parents: b0aeefc Author: Dmytro Sen <d...@apache.org> Authored: Thu Jan 21 15:59:56 2016 +0200 Committer: Dmytro Sen <d...@apache.org> Committed: Thu Jan 21 15:59:56 2016 +0200 ---------------------------------------------------------------------- ambari-common/src/main/python/ambari_commons/firewall.py | 6 +++--- ambari-server/src/test/python/TestAmbariServer.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3c455299/ambari-common/src/main/python/ambari_commons/firewall.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/firewall.py b/ambari-common/src/main/python/ambari_commons/firewall.py index e6a1ff9..64d396b 100644 --- a/ambari-common/src/main/python/ambari_commons/firewall.py +++ b/ambari-common/src/main/python/ambari_commons/firewall.py @@ -129,7 +129,7 @@ class Fedora18FirewallChecks(FirewallChecks): class SuseFirewallChecks(FirewallChecks): def __init__(self): super(SuseFirewallChecks, self).__init__() - self.FIREWALL_SERVICE_NAME = "SuSEfirewall2" + self.FIREWALL_SERVICE_NAME = "rcSuSEfirewall2" def get_command(self): return "%s %s" % (self.FIREWALL_SERVICE_NAME, self.SERVICE_SUBCMD) @@ -137,9 +137,9 @@ class SuseFirewallChecks(FirewallChecks): def check_result(self): result = False if self.returncode == 0: - if "SuSEfirewall2 not active" in self.stdoutdata: + if "unused" in self.stdoutdata: result = False - elif "### iptables" in self.stdoutdata: + elif "running" in self.stdoutdata: result = True return result http://git-wip-us.apache.org/repos/asf/ambari/blob/3c455299/ambari-server/src/test/python/TestAmbariServer.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py index ad4505a..b0e7e9c 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -1880,11 +1880,11 @@ class TestAmbariServer(TestCase): get_os_family_mock.return_value = OSConst.SUSE_FAMILY firewall_obj = Firewall().getFirewallObject() - p.communicate.return_value = ("### iptables", "err") + p.communicate.return_value = ("running", "err") p.returncode = 0 self.assertEqual("SuseFirewallChecks", firewall_obj.__class__.__name__) self.assertTrue(firewall_obj.check_firewall()) - p.communicate.return_value = ("SuSEfirewall2 not active", "err") + p.communicate.return_value = ("unused", "err") p.returncode = 0 self.assertFalse(firewall_obj.check_firewall()) self.assertEqual("err", firewall_obj.stderrdata)