diff --git a/ironic/drivers/modules/redfish/utils.py b/ironic/drivers/modules/redfish/utils.py index b42b20b6a1..b00352492e 100644 --- a/ironic/drivers/modules/redfish/utils.py +++ b/ironic/drivers/modules/redfish/utils.py @@ -135,11 +135,7 @@ def parse_driver_info(node): # Obtain the Redfish root prefix from the address path # If not specified, default to '/redfish/v1/' - root_prefix = '/redfish/v1' - if parsed.path: - normalized_path = parsed.path.rstrip('/') - if normalized_path: - root_prefix = normalized_path + root_prefix = parsed.path redfish_system_id = driver_info.get('redfish_system_id') if redfish_system_id is not None: diff --git a/ironic/tests/unit/drivers/modules/redfish/test_utils.py b/ironic/tests/unit/drivers/modules/redfish/test_utils.py index 9af4fbf79b..4d2597e1c0 100644 --- a/ironic/tests/unit/drivers/modules/redfish/test_utils.py +++ b/ironic/tests/unit/drivers/modules/redfish/test_utils.py @@ -52,8 +52,7 @@ class RedfishUtilsTestCase(db_base.DbTestCase): 'password': 'password', 'verify_ca': True, 'auth_type': 'auto', - 'node_uuid': self.node.uuid, - 'root_prefix': '/redfish/v1', + 'node_uuid': self.node.uuid } def test_parse_driver_info(self): @@ -65,16 +64,6 @@ class RedfishUtilsTestCase(db_base.DbTestCase): response = redfish_utils.parse_driver_info(self.node) self.assertEqual(self.parsed_driver_info, response) - def test_parse_driver_info_default_scheme_with_trailing_slash(self): - self.node.driver_info['redfish_address'] = 'example.com/' - response = redfish_utils.parse_driver_info(self.node) - self.assertEqual(self.parsed_driver_info, response) - - def test_parse_driver_info_default_scheme_with_trailing_slashes(self): - self.node.driver_info['redfish_address'] = 'example.com///' - response = redfish_utils.parse_driver_info(self.node) - self.assertEqual(self.parsed_driver_info, response) - def test_parse_driver_info_default_scheme_with_port(self): self.node.driver_info['redfish_address'] = 'example.com:42' self.parsed_driver_info['address'] = 'https://example.com:42' @@ -173,7 +162,7 @@ class RedfishUtilsTestCase(db_base.DbTestCase): def test_parse_driver_info_with_root_prefix(self): test_redfish_address = 'https://example.com/test/redfish/v0/' self.node.driver_info['redfish_address'] = test_redfish_address - self.parsed_driver_info['root_prefix'] = '/test/redfish/v0' + self.parsed_driver_info['root_prefix'] = '/test/redfish/v0/' response = redfish_utils.parse_driver_info(self.node) self.assertEqual(self.parsed_driver_info, response) @@ -333,7 +322,6 @@ class RedfishUtilsAuthTestCase(db_base.DbTestCase): mock_sushy.assert_called_with( mock.ANY, verify=mock.ANY, auth=mock_session_or_basic_auth.return_value, - root_prefix='/redfish/v1' ) self.assertEqual(len(redfish_utils.SessionCache._sessions), 1) @@ -374,7 +362,7 @@ class RedfishUtilsAuthTestCase(db_base.DbTestCase): mock_sushy.assert_called_with( self.parsed_driver_info['address'], auth=mock_session_or_basic_auth.return_value, - verify=True, root_prefix='/redfish/v1') + verify=True) @mock.patch.object(sushy, 'Sushy', autospec=True) @mock.patch('ironic.drivers.modules.redfish.utils.' @@ -391,8 +379,7 @@ class RedfishUtilsAuthTestCase(db_base.DbTestCase): ) mock_sushy.assert_called_with( mock.ANY, verify=mock.ANY, - auth=mock_session_auth.return_value, - root_prefix='/redfish/v1' + auth=mock_session_auth.return_value ) @mock.patch.object(sushy, 'Sushy', autospec=True) @@ -410,8 +397,7 @@ class RedfishUtilsAuthTestCase(db_base.DbTestCase): ) sushy.Sushy.assert_called_with( mock.ANY, verify=mock.ANY, - auth=mock_basic_auth.return_value, - root_prefix='/redfish/v1' + auth=mock_basic_auth.return_value )