Esempio n. 1
0
 def test_reset_syslog_config_success(self):
     '''
     Tests successful function return for a single ESXi host.
     '''
     self.assertEqual({HOST: {'success': True, 'default-rotate': {'success': True}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='default-rotate'))
Esempio n. 2
0
 def test_reset_syslog_config_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host.
     '''
     self.assertEqual({HOST: {'success': False, 'logdir-unique': {'message': ERROR, 'success': False}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='logdir-unique'))
Esempio n. 3
0
 def test_reset_syslog_config_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host.
     '''
     self.assertEqual({HOST: {'success': False, 'logdir-unique': {'message': ERROR, 'success': False}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='logdir-unique'))
Esempio n. 4
0
 def test_reset_syslog_config_success(self):
     '''
     Tests successful function return for a single ESXi host.
     '''
     self.assertEqual({HOST: {'success': True, 'default-rotate': {'success': True}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='default-rotate'))
Esempio n. 5
0
 def test_reset_syslog_config_success_all_configs(self):
     '''
     Tests successful function return for a single ESXi host when passing in multiple syslog_config values.
     '''
     self.assertEqual(
         {
             HOST: {
                 'success': True,
                 'logdir': {
                     'success': True
                 },
                 'loghost': {
                     'success': True
                 },
                 'default-rotate': {
                     'success': True
                 },
                 'default-size': {
                     'success': True
                 },
                 'default-timeout': {
                     'success': True
                 },
                 'logdir-unique': {
                     'success': True
                 }
             }
         },
         vsphere.reset_syslog_config(HOST,
                                     USER,
                                     PASSWORD,
                                     syslog_config='all'))
Esempio n. 6
0
 def test_reset_syslog_config_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 1, 'stdout': ERROR})):
         self.assertEqual({HOST: {'success': False, 'logdir-unique': {'message': ERROR, 'success': False}}},
                          vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                      syslog_config='logdir-unique'))
Esempio n. 7
0
 def test_reset_syslog_config_invalid_config_param(self):
     '''
     Tests error message returned when an invalid syslog_config parameter is provided.
     '''
     error = 'Invalid syslog configuration parameter'
     self.assertEqual({HOST: {'success': False, 'test': {'message': error, 'success': False}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='test'))
Esempio n. 8
0
 def test_reset_syslog_config_success(self):
     '''
     Tests successful function return for a single ESXi host.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 0, 'stdout': ''})):
         self.assertEqual({HOST: {'success': True, 'default-rotate': {'success': True}}},
                          vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                      syslog_config='default-rotate'))
Esempio n. 9
0
 def test_reset_syslog_config_invalid_config_param(self):
     '''
     Tests error message returned when an invalid syslog_config parameter is provided.
     '''
     error = 'Invalid syslog configuration parameter'
     self.assertEqual({HOST: {'success': False, 'test': {'message': error, 'success': False}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='test'))
Esempio n. 10
0
 def test_reset_syslog_config_host_list_success(self):
     '''
     Tests successful function return when an esxi_host is provided.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'success': True, 'loghost': {'success': True}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='loghost',
                                                  esxi_hosts=[host_1]))
Esempio n. 11
0
 def test_reset_syslog_config_success_multiple_configs(self):
     '''
     Tests successful function return for a single ESXi host when passing in multiple syslog_config values.
     '''
     self.assertEqual({HOST: {'success': True,
                              'default-size': {'success': True},
                              'default-timeout': {'success': True}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='default-size,default-timeout'))
Esempio n. 12
0
 def test_reset_syslog_config_host_list_success(self):
     '''
     Tests successful function return when an esxi_host is provided.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'success': True, 'loghost': {'success': True}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='loghost',
                                                  esxi_hosts=[host_1]))
Esempio n. 13
0
 def test_reset_syslog_config_host_list_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'success': False, 'logdir': {'message': ERROR, 'success': False}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='logdir',
                                                  esxi_hosts=[host_1]))
Esempio n. 14
0
 def test_reset_syslog_config_host_list_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'success': False, 'logdir': {'message': ERROR, 'success': False}}},
                      vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                  syslog_config='logdir',
                                                  esxi_hosts=[host_1]))
Esempio n. 15
0
 def test_reset_syslog_config_invalid_config_param(self):
     '''
     Tests error message returned when an invalid syslog_config parameter is provided.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={})):
         error = 'Invalid syslog configuration parameter'
         self.assertEqual({HOST: {'success': False, 'test': {'message': error, 'success': False}}},
                          vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                      syslog_config='test'))
Esempio n. 16
0
 def test_reset_syslog_config_host_list_success(self):
     '''
     Tests successful function return when an esxi_host is provided.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 0, 'stdout': ''})):
         host_1 = 'host_1.foo.com'
         self.assertEqual({host_1: {'success': True, 'loghost': {'success': True}}},
                          vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                      syslog_config='loghost',
                                                      esxi_hosts=[host_1]))
Esempio n. 17
0
 def test_reset_syslog_config_host_list_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 1, 'stdout': ERROR})):
         host_1 = 'host_1.foo.com'
         self.assertEqual({host_1: {'success': False, 'logdir': {'message': ERROR, 'success': False}}},
                          vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                      syslog_config='logdir',
                                                      esxi_hosts=[host_1]))
Esempio n. 18
0
 def test_reset_syslog_config_success_all_configs(self):
     '''
     Tests successful function return for a single ESXi host when passing in multiple syslog_config values.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 0, 'stdout': ''})):
         self.assertEqual({HOST: {'success': True,
                                  'logdir': {'success': True},
                                  'loghost': {'success': True},
                                  'default-rotate': {'success': True},
                                  'default-size': {'success': True},
                                  'default-timeout': {'success': True},
                                  'logdir-unique': {'success': True}}},
                          vsphere.reset_syslog_config(HOST, USER, PASSWORD,
                                                      syslog_config='all'))