def test_str2bool(self): for b in ('TRUE', 'true', 'True'): self.assertTrue(utils.str2bool(b)) for b in ('FALSE', 'false', 'False'): self.assertFalse(utils.str2bool(b)) self.assertRaises(ValueError, utils.str2bool, 'bogus value')
def _validate(self): self._conf_dict['log']['debug'] = utils.str2bool( self._conf_dict['log']['debug']) self._conf_dict['default']['show_passwords'] = utils.str2bool( self._conf_dict['default']['show_passwords']) self._conf_dict['ipmi']['session_timeout'] = int( self._conf_dict['ipmi']['session_timeout'])
def _validate(self): self._conf_dict['log']['debug'] = utils.str2bool( self._conf_dict['log']['debug']) self._conf_dict['default']['show_passwords'] = utils.str2bool( self._conf_dict['default']['show_passwords']) self._conf_dict['default']['server_port'] = int( self._conf_dict['default']['server_port']) self._conf_dict['default']['server_spawn_wait'] = int( self._conf_dict['default']['server_spawn_wait']) self._conf_dict['default']['server_response_timeout'] = int( self._conf_dict['default']['server_response_timeout']) self._conf_dict['ipmi']['session_timeout'] = int( self._conf_dict['ipmi']['session_timeout'])
def _vbmc_enabled(self, domain_name, lets_enable=None, config=None): if not config: config = self._parse_config(domain_name) try: currently_enabled = utils.str2bool(config['active']) except Exception: currently_enabled = False if (lets_enable is not None and lets_enable != currently_enabled): config.update(active=lets_enable) self._store_config(**config) currently_enabled = lets_enable return currently_enabled