Revert "Fix redfish driver URL parsing"

This reverts commit 5f7c7dcd04.

Reason for revert: seems to be causing an authentication loop between sushy and sushy-tools 

Change-Id: Ic6142bcfa7ea2746d704625548edbef3bb57cad1
This commit is contained in:
Riccardo Pittau
2025-05-21 13:37:59 +00:00
parent 56d43ff56d
commit c7ccec9d8b
2 changed files with 6 additions and 24 deletions

View File

@@ -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:

View File

@@ -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
)