You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2015/03/13 02:48:05 UTC

[3/3] ambari git commit: AMBARI-10051: Remove iptables hardcoding to make firewall check messages more generic (jluniya)

AMBARI-10051: Remove iptables hardcoding to make firewall check messages more generic (jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/776c93f0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/776c93f0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/776c93f0

Branch: refs/heads/trunk
Commit: 776c93f0606815f57e0c78ca5af583b8ceba5e1f
Parents: 7b1500e
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Thu Mar 12 18:47:55 2015 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Thu Mar 12 18:47:55 2015 -0700

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/HostInfo.py    |   27 +-
 .../test/python/ambari_agent/TestHostInfo.py    |   15 +-
 .../groovy-client/src/test/resources/hosts.json |    3 +-
 .../src/main/python/ambari_commons/firewall.py  |   28 +-
 .../apache/ambari/server/agent/AgentEnv.java    |   20 +-
 .../python/ambari_server/serverConfiguration.py |    2 +-
 .../main/python/ambari_server/serverSetup.py    |    2 +-
 .../src/main/python/ambari_server_main.py       |    4 +-
 .../ambari/server/agent/AgentResourceTest.java  |    5 +-
 .../src/test/python/TestAmbariServer.py         |   18 +-
 .../test/python/custom_actions/TestCheckHost.py |    9 +-
 .../test/python/stacks/2.1/common/hosts.json    |   27 +-
 .../test/python/stacks/2.2/common/2/hosts.json  | 1191 ++++++++++++------
 .../app/controllers/wizard/step3_controller.js  |    4 +-
 ambari-web/app/messages.js                      |    1 -
 .../test/controllers/wizard/step3_test.js       |    8 +-
 16 files changed, 892 insertions(+), 472 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-agent/src/main/python/ambari_agent/HostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostInfo.py b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
index 516221d..b0b96cc 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostInfo.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
@@ -101,6 +101,12 @@ class HostInfo(object):
     else:
       return self.current_umask
 
+  def checkFirewall(self):
+    return Firewall().getFirewallObject().check_firewall()
+
+  def getFirewallName(self):
+    return Firewall().getFirewallObject().get_firewall_name()
+
   def checkReverseLookup(self):
     """
     Check if host fqdn resolves to current host ip
@@ -229,9 +235,6 @@ class HostInfoLinux(HostInfo):
     else:
       return ""
 
-  def checkIptables(self):
-    return Firewall().getFirewallObject().check_iptables()
-
   def hadoopVarRunCount(self):
     if not os.path.exists('/var/run/hadoop'):
       return 0
@@ -277,7 +280,8 @@ class HostInfoLinux(HostInfo):
     dict['umask'] = str(self.getUMask())
 
     dict['transparentHugePage'] = self.getTransparentHugePage()
-    dict['iptablesIsRunning'] = self.checkIptables()
+    dict['firewallRunning'] = self.checkFirewall()
+    dict['firewallName'] = self.getFirewallName()
     dict['reverseLookup'] = self.checkReverseLookup()
     # If commands are in progress or components are already mapped to this host
     # Then do not perform certain expensive host checks
@@ -340,18 +344,6 @@ class HostInfoWindows(HostInfo):
         result['status'] = "Available"
         results.append(result)
 
-  def checkIptables(self):
-    from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT
-
-    out = run_powershell_script(CHECK_FIREWALL_SCRIPT)
-    if out[0] != 0:
-      logger.warn("Unable to check firewall status:{0}".format(out[2]))
-      return False
-    profiles_status = [i for i in out[1].split("\n") if not i == ""]
-    if "1" in profiles_status:
-      return True
-    return False
-
   def createAlerts(self, alerts):
     # TODO AMBARI-7849 Implement createAlerts for Windows
     return alerts
@@ -404,7 +396,8 @@ class HostInfoWindows(HostInfo):
 
     dict['umask'] = str(self.getUMask())
 
-    dict['iptablesIsRunning'] = self.checkIptables()
+    dict['firewallRunning'] = self.checkFirewall()
+    dict['firewallName'] = self.getFirewallName()
     dict['reverseLookup'] = self.checkReverseLookup()
     # If commands are in progress or components are already mapped to this host
     # Then do not perform certain expensive host checks

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py b/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
index fcab6b8..5ea67ce 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
@@ -256,7 +256,7 @@ class TestHostInfo(TestCase):
   @patch.object(HostInfoLinux, 'etcAlternativesConf')
   @patch.object(HostInfoLinux, 'hadoopVarRunCount')
   @patch.object(HostInfoLinux, 'hadoopVarLogCount')
-  @patch.object(HostInfoLinux, 'checkIptables')
+  @patch.object(HostInfoLinux, 'checkFirewall')
   def test_hostinfo_register_suse(self, cit_mock, hvlc_mock, hvrc_mock, eac_mock, cf_mock, jp_mock,
                              cls_mock, cu_mock, gir_mock, gipbr_mock, gipbn_mock,
                              gpd_mock, aip_mock, aap_mock, whcf_mock, os_umask_mock, get_os_type_mock):
@@ -294,7 +294,7 @@ class TestHostInfo(TestCase):
   @patch.object(HostInfoLinux, 'etcAlternativesConf')
   @patch.object(HostInfoLinux, 'hadoopVarRunCount')
   @patch.object(HostInfoLinux, 'hadoopVarLogCount')
-  @patch.object(HostInfoLinux, 'checkIptables')
+  @patch.object(HostInfoLinux, 'checkFirewall')
   @patch.object(HostInfoLinux, 'getTransparentHugePage')
   def test_hostinfo_register(self, get_transparentHuge_page_mock, cit_mock, hvlc_mock, hvrc_mock, eac_mock, cf_mock, jp_mock,
                              cls_mock, cu_mock, gir_mock, gipbr_mock, gipbn_mock,
@@ -331,7 +331,8 @@ class TestHostInfo(TestCase):
     self.assertEqual(dict['alternatives'], [])
     self.assertEqual(dict['stackFoldersAndFiles'], [])
     self.assertEqual(dict['existingUsers'], [])
-    self.assertTrue(dict['iptablesIsRunning'])
+    self.assertTrue(dict['firewallRunning'])
+    self.assertEqual(dict['firewallName'], "iptables")
 
   @patch("os.path.exists")
   @patch("os.path.islink")
@@ -511,11 +512,11 @@ class TestHostInfo(TestCase):
   @patch.object(OSCheck, "get_os_type")
   @patch.object(OSCheck, "get_os_major_version")
   @patch("ambari_commons.firewall.run_os_command")
-  def test_IpTablesRunning(self, run_os_command_mock, get_os_major_version_mock, get_os_type_mock, get_os_family_mock):
+  def test_FirewallRunning(self, run_os_command_mock, get_os_major_version_mock, get_os_type_mock, get_os_family_mock):
     get_os_type_mock.return_value = ""
     get_os_family_mock.return_value = OSConst.REDHAT_FAMILY
     run_os_command_mock.return_value = 0, "Table: filter", ""
-    self.assertTrue(Firewall().getFirewallObject().check_iptables())
+    self.assertTrue(Firewall().getFirewallObject().check_firewall())
 
 
   @patch.object(socket, "getfqdn")
@@ -547,11 +548,11 @@ class TestHostInfo(TestCase):
   @patch.object(OSCheck, "get_os_type")
   @patch.object(OSCheck, "get_os_major_version")
   @patch("ambari_commons.firewall.run_os_command")
-  def test_IpTablesStopped(self, run_os_command_mock, get_os_major_version_mock, get_os_type_mock, get_os_family_mock):
+  def test_FirewallStopped(self, run_os_command_mock, get_os_major_version_mock, get_os_type_mock, get_os_family_mock):
     get_os_type_mock.return_value = ""
     get_os_family_mock.return_value = OSConst.REDHAT_FAMILY
     run_os_command_mock.return_value = 3, "", ""
-    self.assertFalse(Firewall().getFirewallObject().check_iptables())
+    self.assertFalse(Firewall().getFirewallObject().check_firewall())
 
   @not_for_platform(PLATFORM_WINDOWS)
   @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = ('redhat','11','Final')))

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-client/groovy-client/src/test/resources/hosts.json
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/test/resources/hosts.json b/ambari-client/groovy-client/src/test/resources/hosts.json
index 81ed565..b1fa47e 100644
--- a/ambari-client/groovy-client/src/test/resources/hosts.json
+++ b/ambari-client/groovy-client/src/test/resources/hosts.json
@@ -75,7 +75,8 @@
             ]
           },
           "umask" : 18,
-          "iptablesIsRunning" : true
+          "firewallRunning" : true,
+          "firewallName" : "iptables"
         },
         "last_heartbeat_time" : 1401222535701,
         "last_registration_time" : 1401180386121,

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/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 311e6d5..2c4108e 100644
--- a/ambari-common/src/main/python/ambari_commons/firewall.py
+++ b/ambari-common/src/main/python/ambari_commons/firewall.py
@@ -63,7 +63,10 @@ class FirewallChecks(object):
     self.stdoutdata = None
     self.stderrdata = None
     # stdout message
-    self.MESSAGE_CHECK_FIREWALL = 'Checking iptables...'
+    self.MESSAGE_CHECK_FIREWALL = 'Checking firewall status...'
+
+  def get_firewall_name(self):
+    return self.FIREWALL_SERVICE_NAME
 
   def get_command(self):
     return "%s %s %s" % (self.SERVICE_CMD, self.FIREWALL_SERVICE_NAME, self.SERVICE_SUBCMD)
@@ -83,7 +86,7 @@ class FirewallChecks(object):
     self.stdoutdata = out
     self.stderrdata = err
 
-  def check_iptables(self):
+  def check_firewall(self):
     try:
       self.run_command()
       return self.check_result()
@@ -144,15 +147,20 @@ class SuseFirewallChecks(FirewallChecks):
 class WindowsFirewallChecks(FirewallChecks):
   def __init__(self):
     super(WindowsFirewallChecks, self).__init__()
-    self.MESSAGE_CHECK_FIREWALL = 'Checking firewall status...'
+    self.FIREWALL_SERVICE_NAME = "MpsSvc"
 
   def run_command(self):
-    from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT
+    from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT, WinServiceController, SERVICE_STATUS_RUNNING
 
-    retcode, out, err = run_powershell_script(CHECK_FIREWALL_SCRIPT)
-    self.returncode = retcode
-    self.stdoutdata = out
-    self.stderrdata = err
+    if WinServiceController.QueryStatus(self.FIREWALL_SERVICE_NAME) != SERVICE_STATUS_RUNNING:
+      self.returncode = 0
+      self.stdoutdata = ""
+      self.stderrdata = ""
+    else:
+      retcode, out, err = run_powershell_script(CHECK_FIREWALL_SCRIPT)
+      self.returncode = retcode
+      self.stdoutdata = out
+      self.stderrdata = err
 
   def check_result(self):
     if self.returncode != 0:
@@ -170,5 +178,5 @@ class WindowsFirewallChecks(FirewallChecks):
       print_warning_msg(
         "Following firewall profiles are enabled:{0}. Make sure that the firewall is properly configured.".format(
           ",".join(enabled_profiles)))
-      return False
-    return True
+      return True
+    return False

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java
index c3e9c53..ede3965 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentEnv.java
@@ -60,7 +60,9 @@ public class AgentEnv {
 
   private String transparentHugePage;
 
-  private Boolean iptablesIsRunning;
+  private Boolean firewallRunning;
+
+  private String firewallName;
 
   private Boolean reverseLookup;
 
@@ -136,12 +138,20 @@ public class AgentEnv {
     return hostHealth;
   }
 
-  public Boolean getIptablesIsRunning() {
-    return iptablesIsRunning;
+  public Boolean getFirewallRunning() {
+    return firewallRunning;
+  }
+
+  public void setFirewallRunning(Boolean firewallRunning) {
+    this.firewallRunning = firewallRunning;
+  }
+
+  public String getFirewallName() {
+    return firewallName;
   }
 
-  public void setIptablesIsRunning(Boolean iptablesIsRunning) {
-    this.iptablesIsRunning = iptablesIsRunning;
+  public void setFirewallName(String firewallName) {
+    this.firewallName = firewallName;
   }
 
   public static class HostHealth {

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-server/src/main/python/ambari_server/serverConfiguration.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index a00be1b..35d14f5 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -342,7 +342,7 @@ class ServerConfigDefaultsLinux(ServerConfigDefaults):
     self.MESSAGE_ERROR_SETUP_NOT_ROOT = "Ambari-server setup should be run with root-level privileges"
     self.MESSAGE_ERROR_RESET_NOT_ROOT = "Ambari-server reset should be run with root-level privileges"
     self.MESSAGE_ERROR_UPGRADE_NOT_ROOT = "Ambari-server upgrade must be run with root-level privileges"
-    self.MESSAGE_CHECK_FIREWALL = "Checking iptables..."
+    self.MESSAGE_CHECK_FIREWALL = "Checking firewall status..."
 
 configDefaults = ServerConfigDefaults()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-server/src/main/python/ambari_server/serverSetup.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverSetup.py b/ambari-server/src/main/python/ambari_server/serverSetup.py
index 2b4e06b..1701f09 100644
--- a/ambari-server/src/main/python/ambari_server/serverSetup.py
+++ b/ambari-server/src/main/python/ambari_server/serverSetup.py
@@ -291,7 +291,7 @@ def check_ambari_user():
 
 def check_firewall():
   firewall_obj = Firewall().getFirewallObject()
-  firewall_on = firewall_obj.check_iptables()
+  firewall_on = firewall_obj.check_firewall()
   if firewall_obj.stderrdata and len(firewall_obj.stderrdata) > 0:
     print firewall_obj.stderrdata
   if firewall_on:

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-server/src/main/python/ambari_server_main.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server_main.py b/ambari-server/src/main/python/ambari_server_main.py
index 09dfc96..1847f94 100644
--- a/ambari-server/src/main/python/ambari_server_main.py
+++ b/ambari-server/src/main/python/ambari_server_main.py
@@ -131,8 +131,8 @@ def ensure_server_security_is_configured():
 @OsFamilyFuncImpl(OsFamilyImpl.DEFAULT)
 def ensure_server_security_is_configured():
   if not is_root():
-    print "Unable to check iptables status when starting without root privileges."
-    print "Please do not forget to disable or adjust iptables if needed"
+    print "Unable to check firewall status when starting without root privileges."
+    print "Please do not forget to disable or adjust firewall if needed"
 
 
 def get_ulimit_open_files(properties):

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
index c3e4b9b..c12e737 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
@@ -198,7 +198,7 @@ public class AgentResourceTest extends JerseyTest {
             ", \"existingUsers\": "+ ExistingUserJSON +
             ", \"umask\": \"18\", \"installedPackages\": "+
             PackageDetailJSON +", \"stackFoldersAndFiles\": "+ DirectoryJSON +
-            ", \"iptablesIsRunning\": \"true\", \"transparentHugePage\": \"never\"}";
+            ", \"firewallRunning\": \"true\", \"firewallName\": \"iptables\", \"transparentHugePage\": \"never\"}";
     AgentEnv.Directory[] dirs = getJsonFormString(
             DirectoryJSON, AgentEnv.Directory[].class);
     Assert.assertEquals("/var/lib", dirs[0].getName());
@@ -234,7 +234,8 @@ public class AgentResourceTest extends JerseyTest {
             AgentEnvJSON, AgentEnv.class);
     Assert.assertTrue(18 == agentEnv.getUmask());
     Assert.assertEquals("never", agentEnv.getTransparentHugePage());
-    Assert.assertTrue(Boolean.TRUE == agentEnv.getIptablesIsRunning());
+    Assert.assertTrue(Boolean.TRUE == agentEnv.getFirewallRunning());
+    Assert.assertEquals("iptables", agentEnv.getFirewallName());
     Assert.assertEquals("/etc/alternatives/hdfs-conf", agentEnv.getAlternatives()[0].getName());
     Assert.assertEquals("/etc/hadoop/conf.dist", agentEnv.getAlternatives()[0].getTarget());
     Assert.assertEquals("abc", agentEnv.getAlternatives()[1].getName());

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/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 cae847d..83c27a6 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -1302,7 +1302,7 @@ class TestAmbariServer(TestCase):
   @patch.object(OSCheck, "get_os_family")
   @patch.object(OSCheck, "get_os_type")
   @patch.object(OSCheck, "get_os_major_version")
-  def test_check_iptables_is_running(self, get_os_major_version_mock, get_os_type_mock, get_os_family_mock, popen_mock):
+  def test_check_firewall_is_running(self, get_os_major_version_mock, get_os_type_mock, get_os_family_mock, popen_mock):
 
     get_os_major_version_mock.return_value = 18
     get_os_type_mock.return_value = OSConst.OS_FEDORA
@@ -1314,10 +1314,10 @@ class TestAmbariServer(TestCase):
     p.returncode = 0
     popen_mock.return_value = p
     self.assertEqual("Fedora18FirewallChecks", firewall_obj.__class__.__name__)
-    self.assertTrue(firewall_obj.check_iptables())
+    self.assertTrue(firewall_obj.check_firewall())
     p.communicate.return_value = ("", "err")
     p.returncode = 3
-    self.assertFalse(firewall_obj.check_iptables())
+    self.assertFalse(firewall_obj.check_firewall())
     self.assertEqual("err", firewall_obj.stderrdata)
 
 
@@ -1328,10 +1328,10 @@ class TestAmbariServer(TestCase):
     p.communicate.return_value = ("Status: active", "err")
     p.returncode = 0
     self.assertEqual("UbuntuFirewallChecks", firewall_obj.__class__.__name__)
-    self.assertTrue(firewall_obj.check_iptables())
+    self.assertTrue(firewall_obj.check_firewall())
     p.communicate.return_value = ("Status: inactive", "err")
     p.returncode = 0
-    self.assertFalse(firewall_obj.check_iptables())
+    self.assertFalse(firewall_obj.check_firewall())
     self.assertEqual("err", firewall_obj.stderrdata)
 
     get_os_type_mock.return_value = ""
@@ -1341,10 +1341,10 @@ class TestAmbariServer(TestCase):
     p.communicate.return_value = ("### iptables", "err")
     p.returncode = 0
     self.assertEqual("SuseFirewallChecks", firewall_obj.__class__.__name__)
-    self.assertTrue(firewall_obj.check_iptables())
+    self.assertTrue(firewall_obj.check_firewall())
     p.communicate.return_value = ("SuSEfirewall2 not active", "err")
     p.returncode = 0
-    self.assertFalse(firewall_obj.check_iptables())
+    self.assertFalse(firewall_obj.check_firewall())
     self.assertEqual("err", firewall_obj.stderrdata)
 
     get_os_type_mock.return_value = ""
@@ -1354,10 +1354,10 @@ class TestAmbariServer(TestCase):
     p.communicate.return_value = ("Table: filter", "err")
     p.returncode = 0
     self.assertEqual("FirewallChecks", firewall_obj.__class__.__name__)
-    self.assertTrue(firewall_obj.check_iptables())
+    self.assertTrue(firewall_obj.check_firewall())
     p.communicate.return_value = ("", "err")
     p.returncode = 3
-    self.assertFalse(firewall_obj.check_iptables())
+    self.assertFalse(firewall_obj.check_firewall())
     self.assertEqual("err", firewall_obj.stderrdata)
     pass
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-server/src/test/python/custom_actions/TestCheckHost.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/TestCheckHost.py b/ambari-server/src/test/python/custom_actions/TestCheckHost.py
index ff16298..e0ef2d7 100644
--- a/ambari-server/src/test/python/custom_actions/TestCheckHost.py
+++ b/ambari-server/src/test/python/custom_actions/TestCheckHost.py
@@ -251,10 +251,10 @@ class TestCheckHost(TestCase):
   @patch('ambari_agent.HostInfo.HostInfoLinux.checkLiveServices')
   @patch('ambari_agent.HostInfo.HostInfoLinux.getUMask')
   @patch('ambari_agent.HostInfo.HostInfoLinux.getTransparentHugePage')
-  @patch('ambari_agent.HostInfo.HostInfoLinux.checkIptables')
+  @patch('ambari_agent.HostInfo.HostInfoLinux.checkFirewall')
   @patch('ambari_agent.HostInfo.HostInfoLinux.checkReverseLookup')
   @patch('time.time')
-  def testLastAgentEnv(self, time_mock, checkReverseLookup_mock, checkIptables_mock, getTransparentHugePage_mock,
+  def testLastAgentEnv(self, time_mock, checkReverseLookup_mock, checkFirewall_mock, getTransparentHugePage_mock,
                        getUMask_mock, checkLiveServices_mock, javaProcs_mock, put_structured_out_mock,
                        get_tmp_dir_mock, get_config_mock, systemmock):
     jsonFilePath = os.path.join(TestCheckHost.current_dir+"/../../resources/custom_actions", "check_last_agent_env.json")
@@ -270,7 +270,7 @@ class TestCheckHost(TestCase):
     # ensure the correct function was called
     self.assertTrue(time_mock.called)
     self.assertTrue(checkReverseLookup_mock.called)
-    self.assertTrue(checkIptables_mock.called)
+    self.assertTrue(checkFirewall_mock.called)
     self.assertTrue(getTransparentHugePage_mock.called)
     self.assertTrue(getUMask_mock.called)
     self.assertTrue(checkLiveServices_mock.called)
@@ -280,7 +280,8 @@ class TestCheckHost(TestCase):
     last_agent_env_check_result = put_structured_out_mock.call_args[0][0]
     self.assertTrue('last_agent_env_check' in last_agent_env_check_result)
     self.assertTrue('hostHealth' in last_agent_env_check_result['last_agent_env_check'])
-    self.assertTrue('iptablesIsRunning' in last_agent_env_check_result['last_agent_env_check'])
+    self.assertTrue('firewallRunning' in last_agent_env_check_result['last_agent_env_check'])
+    self.assertTrue('firewallName' in last_agent_env_check_result['last_agent_env_check'])
     self.assertTrue('reverseLookup' in last_agent_env_check_result['last_agent_env_check'])
     self.assertTrue('alternatives' in last_agent_env_check_result['last_agent_env_check'])
     self.assertTrue('umask' in last_agent_env_check_result['last_agent_env_check'])

http://git-wip-us.apache.org/repos/asf/ambari/blob/776c93f0/ambari-server/src/test/python/stacks/2.1/common/hosts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/common/hosts.json b/ambari-server/src/test/python/stacks/2.1/common/hosts.json
index ad6ac46..b8f8610 100644
--- a/ambari-server/src/test/python/stacks/2.1/common/hosts.json
+++ b/ambari-server/src/test/python/stacks/2.1/common/hosts.json
@@ -49,7 +49,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083477169,
@@ -110,7 +111,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083476356,
@@ -171,7 +173,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083481320,
@@ -232,7 +235,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083477282,
@@ -293,7 +297,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083478406,
@@ -354,7 +359,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083479135,
@@ -415,7 +421,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083477378,
@@ -476,7 +483,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083477295,
@@ -537,7 +545,8 @@
           },
           "umask" : 18,
           "transparentHugePage" : "always",
-          "iptablesIsRunning" : true,
+          "firewallRunning" : true,
+          "firewallName" : "iptables",
           "reverseLookup" : true
         },
         "last_heartbeat_time" : 1412083478342,