Fix error triggered by reading intergers as string from virtualbmc.conf
Add validation to fix error of "'<' not supported between instances of 'str' and 'int'" when defining server_response_timeout value in virtualbmc.conf. The error is trigger because the config parameters from the configuration file are read as strings and everything else assume that value is an integer (as the default of 5000). The patch also include validations for server_spawn_wait and server_port to check the values are valid integers. Updates test_config.test_validate for test coverage Task: 37947 Story: 2007066 Change-Id: Ie4e74585d8e14bd73e5e30b21b4dd7bd7d88f13d Signed-off-by: William Caban <william.caban@gmail.com>
This commit is contained in:
parent
3ef73c8d8f
commit
0884014df2
@ -75,6 +75,15 @@ class VirtualBMCConfig(object):
|
||||
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'])
|
||||
|
||||
|
@ -72,6 +72,9 @@ class VirtualBMCConfigTestCase(base.TestCase):
|
||||
|
||||
expected = self.config_dict.copy()
|
||||
expected['default']['show_passwords'] = True
|
||||
expected['default']['server_response_timeout'] = 5000
|
||||
expected['default']['server_spawn_wait'] = 3000
|
||||
expected['default']['server_port'] = 12345
|
||||
expected['log']['debug'] = True
|
||||
expected['ipmi']['session_timeout'] = 30
|
||||
self.assertEqual(expected, self.vbmc_config._conf_dict)
|
||||
|
Loading…
Reference in New Issue
Block a user