Repository: ambari Updated Branches: refs/heads/trunk c65e53e1c -> 0caf76005
Revert "AMBARI-17047. AMBARI-17047: Firewall check returns WARNING even if iptables and firewalld are stopped on CentOS7 (Masahiro Tanaka via aonishuk)" This reverts commit c65e53e1c503ca9e4e465d4529f6aabdab296f1c. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0caf7600 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0caf7600 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0caf7600 Branch: refs/heads/trunk Commit: 0caf76005b04b8fa90e3d76f295d5ad53323bab4 Parents: c65e53e Author: Andrew Onishuk <[email protected]> Authored: Wed Jul 6 17:22:03 2016 +0300 Committer: Andrew Onishuk <[email protected]> Committed: Wed Jul 6 17:22:03 2016 +0300 ---------------------------------------------------------------------- .../src/main/python/ambari_commons/firewall.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0caf7600/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 6868d3f..72e6d26 100644 --- a/ambari-common/src/main/python/ambari_commons/firewall.py +++ b/ambari-common/src/main/python/ambari_commons/firewall.py @@ -21,7 +21,7 @@ limitations under the License. from ambari_commons import OSCheck, OSConst from ambari_commons.logging_utils import print_warning_msg from ambari_commons.os_family_impl import OsFamilyImpl -from ambari_commons.os_utils import run_os_command +from ambari_commons.os_utils import run_os_command, run_in_shell class Firewall(object): @@ -120,17 +120,13 @@ class RedHat7FirewallChecks(FirewallChecks): #firewalld added to support default firewall (started from RHEL7/CentOS7) #script default iptables checked as user can use iptables as known from previous RHEL releases. def get_command(self): - return "%(servcmd)s is-active %(fwl1)s %(fwl2)s" % {"servcmd":self.SERVICE_CMD,"fwl1":"iptables", "fwl2":"firewalld"} + return "%(servcmd)s is-active %(fwl1)s || %(servcmd)s is-active %(fwl2)s" % {"servcmd":self.SERVICE_CMD,"fwl1":"iptables", "fwl2":"firewalld"} def check_result(self): - for line in self.stdoutdata.split("\n"): - if line.strip() == "active": - return True - return False - + return self.returncode == 0 def run_command(self): - retcode, out, err = run_os_command(self.get_command()) + retcode, out, err = run_in_shell(self.get_command()) self.returncode = retcode self.stdoutdata = out self.stderrdata = err
