Fix a bug error by passwords only includes numbers
When an IPMI password consists only of numbers, Ironic fails to create a password file. From the format point of view, these passwords are correct. These are that it is stored to the variable after being converted to an int type, cause errors in the subsequent processing to expect that it is a string type. Change-Id: I85ee2e904fdb0d538f69c7dbfab4c81bb080b8cf Closes-Bug: #1489234
This commit is contained in:
parent
ea651baf47
commit
93f99381ac
|
@ -254,7 +254,7 @@ def _parse_driver_info(node):
|
|||
|
||||
address = info.get('ipmi_address')
|
||||
username = info.get('ipmi_username')
|
||||
password = info.get('ipmi_password')
|
||||
password = six.text_type(info.get('ipmi_password', ''))
|
||||
port = info.get('ipmi_terminal_port')
|
||||
priv_level = info.get('ipmi_priv_level', 'ADMINISTRATOR')
|
||||
bridging_type = info.get('ipmi_bridging', 'no')
|
||||
|
|
|
@ -578,6 +578,17 @@ class IPMIToolPrivateMethodTestCase(db_base.DbTestCase):
|
|||
self.assertEqual(mock.call('single_bridge'),
|
||||
mock_support.call_args)
|
||||
|
||||
def test__parse_driver_info_numeric_password(
|
||||
self, mock_sleep):
|
||||
# ipmi_password must not be converted to int / float
|
||||
# even if it includes just numbers.
|
||||
info = dict(INFO_DICT)
|
||||
info['ipmi_password'] = 12345678
|
||||
node = obj_utils.get_test_node(self.context, driver_info=info)
|
||||
ret = ipmi._parse_driver_info(node)
|
||||
self.assertEqual(six.u('12345678'), ret['password'])
|
||||
self.assertIsInstance(ret['password'], six.text_type)
|
||||
|
||||
def test__parse_driver_info_ipmi_prot_version_1_5(self, mock_sleep):
|
||||
info = dict(INFO_DICT)
|
||||
info['ipmi_protocol_version'] = '1.5'
|
||||
|
|
Loading…
Reference in New Issue