本文整理汇总了Python中ambari_agent.HostInfo.HostInfo.getFirewallObjectTypes方法的典型用法代码示例。如果您正苦于以下问题:Python HostInfo.getFirewallObjectTypes方法的具体用法?Python HostInfo.getFirewallObjectTypes怎么用?Python HostInfo.getFirewallObjectTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ambari_agent.HostInfo.HostInfo
的用法示例。
在下文中一共展示了HostInfo.getFirewallObjectTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run_os_command_exception
# 需要导入模块: from ambari_agent.HostInfo import HostInfo [as 别名]
# 或者: from ambari_agent.HostInfo.HostInfo import getFirewallObjectTypes [as 别名]
def test_run_os_command_exception(self, popen_mock):
def base_test():
return "base test"
def sub_test():
return "output 1", "error 1"
base_test.communicate = sub_test
base_test.returncode = 0
hostInfo = HostInfo()
for firewallType in hostInfo.getFirewallObjectTypes():
firewall = firewallType()
popen_mock.side_effect = None
popen_mock.return_value = base_test
self.assertTrue(firewall.check_iptables())
popen_mock.side_effect = OSError('File not found')
popen_mock.return_value = None
self.assertFalse(firewall.check_iptables())
示例2: test_IpTablesStopped
# 需要导入模块: from ambari_agent.HostInfo import HostInfo [as 别名]
# 或者: from ambari_agent.HostInfo.HostInfo import getFirewallObjectTypes [as 别名]
def test_IpTablesStopped(self, run_os_command_mock):
hostInfo = HostInfo()
for firewallType in hostInfo.getFirewallObjectTypes():
firewall = firewallType()
run_os_command_mock.return_value = firewall.get_stopped_result()
self.assertFalse(firewall.check_iptables())
示例3: test_IpTablesRunning
# 需要导入模块: from ambari_agent.HostInfo import HostInfo [as 别名]
# 或者: from ambari_agent.HostInfo.HostInfo import getFirewallObjectTypes [as 别名]
def test_IpTablesRunning(self, run_os_command_mock):
hostInfo = HostInfo()
for firewallType in hostInfo.getFirewallObjectTypes():
firewall = firewallType()
run_os_command_mock.return_value = firewall.get_running_result()
self.assertTrue(firewall.check_iptables())