예제 #1
0
 def test_set_syslog_config_firewall_success(self):
     '''
     Tests successful function return for a single ESXi host with 'loghost' as syslog_config.
     '''
     self.assertEqual({HOST: {'enable_firewall': {'success': True}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True))
예제 #2
0
 def test_set_syslog_config_firewall_success(self):
     '''
     Tests successful function return for a single ESXi host with 'loghost' as syslog_config.
     '''
     self.assertEqual({HOST: {'enable_firewall': {'success': True}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True))
예제 #3
0
 def test_set_syslog_config_firewall_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host with 'loghost' as syslog_config.
     '''
     self.assertEqual({HOST: {'enable_firewall': {'message': ERROR, 'success': False}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True))
예제 #4
0
 def test_set_syslog_config_firewall_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host with 'loghost' as syslog_config.
     '''
     self.assertEqual({HOST: {'enable_firewall': {'message': ERROR, 'success': False}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True))
예제 #5
0
 def test_set_syslog_config_host_list_firewall_success(self):
     '''
     Tests successful function return with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'enable_firewall': {'success': True}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True,
                                                esxi_hosts=[host_1]))
예제 #6
0
 def test_set_syslog_config_host_list_firewall_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'enable_firewall': {'message': ERROR, 'success': False}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True,
                                                esxi_hosts=[host_1]))
예제 #7
0
 def test_set_syslog_config_host_list_firewall_success(self):
     '''
     Tests successful function return with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'enable_firewall': {'success': True}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True,
                                                esxi_hosts=[host_1]))
예제 #8
0
 def test_set_syslog_config_host_list_firewall_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'enable_firewall': {'message': ERROR, 'success': False}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True,
                                                esxi_hosts=[host_1]))
예제 #9
0
 def test_set_syslog_config_firewall_success(self):
     '''
     Tests successful function return for a single ESXi host with 'loghost' as syslog_config.
     '''
     with patch('salt.modules.vsphere.enable_firewall_ruleset',
                MagicMock(return_value={HOST: {'retcode': 0}})):
         with patch('salt.modules.vsphere._set_syslog_config_helper',
                    MagicMock(return_value={})):
             self.assertEqual({HOST: {'enable_firewall': {'success': True}}},
                              vsphere.set_syslog_config(HOST,
                                                        USER,
                                                        PASSWORD,
                                                        'loghost',
                                                        'foo',
                                                        firewall=True))
예제 #10
0
 def test_set_syslog_config_firewall_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host with 'loghost' as syslog_config.
     '''
     with patch('salt.modules.vsphere.enable_firewall_ruleset',
                MagicMock(return_value={HOST: {'retcode': 1, 'stdout': ERROR}})):
         with patch('salt.modules.vsphere._set_syslog_config_helper',
                    MagicMock(return_value={})):
             self.assertEqual({HOST: {'enable_firewall': {'message': ERROR, 'success': False}}},
                              vsphere.set_syslog_config(HOST,
                                                        USER,
                                                        PASSWORD,
                                                        'loghost',
                                                        'foo',
                                                        firewall=True))
예제 #11
0
 def test_set_syslog_config_host_list_firewall_success(self):
     '''
     Tests successful function return with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     with patch('salt.modules.vsphere.enable_firewall_ruleset',
                MagicMock(return_value={'host_1.foo.com': {'retcode': 0}})):
         with patch('salt.modules.vsphere._set_syslog_config_helper',
                    MagicMock(return_value={})):
             host_1 = 'host_1.foo.com'
             self.assertEqual({host_1: {'enable_firewall': {'success': True}}},
                              vsphere.set_syslog_config(HOST,
                                                        USER,
                                                        PASSWORD,
                                                        'loghost',
                                                        'foo',
                                                        firewall=True,
                                                        esxi_hosts=[host_1]))
예제 #12
0
 def test_set_syslog_config_host_list_firewall_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     with patch('salt.modules.vsphere.enable_firewall_ruleset',
                MagicMock(return_value={'host_1.foo.com': {'retcode': 1, 'stdout': ERROR}})):
         with patch('salt.modules.vsphere._set_syslog_config_helper',
                    MagicMock(return_value={})):
             host_1 = 'host_1.foo.com'
             self.assertEqual({host_1: {'enable_firewall': {'message': ERROR, 'success': False}}},
                              vsphere.set_syslog_config(HOST,
                                                        USER,
                                                        PASSWORD,
                                                        'loghost',
                                                        'foo',
                                                        firewall=True,
                                                        esxi_hosts=[host_1]))