Browse Source

Merge "Followup idrac configuration mold steps" into stable/wallaby

changes/96/785196/1
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
a49c6536d1
2 changed files with 14 additions and 22 deletions
  1. +6
    -6
      ironic/drivers/modules/drac/management.py
  2. +8
    -16
      ironic/tests/unit/drivers/modules/drac/test_management.py

+ 6
- 6
ironic/drivers/modules/drac/management.py View File

@ -359,7 +359,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
if not system.managers:
raise exception.DracOperationError(
error=(_("No managers found for %(node)s"),
error=(_("No managers found for %(node)s") %
{'node': task.node.uuid}))
for manager in system.managers:
@ -400,7 +400,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
configuration)
else:
raise exception.DracOperationError(
error=(_("No configuration exported for node %(node)s"),
error=(_("No configuration exported for node %(node)s") %
{'node': task.node.uuid}))
@base.deploy_step(priority=0, argsinfo=IMPORT_CONFIGURATION_ARGSINFO)
@ -428,7 +428,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
if not configuration:
raise exception.DracOperationError(
error=(_("No configuration found for node %(node)s by name "
"%(configuration_name)s"),
"%(configuration_name)s") %
{'node': task.node.uuid,
'configuration_name': import_configuration_location}))
@ -437,7 +437,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
raise exception.DracOperationError(
error=(_("Invalid configuration for node %(node)s "
"in %(configuration_name)s. Supports only "
"idrac-redfish, but found %(interface)s"),
"idrac-redfish, but found %(interface)s") %
{'node': task.node.uuid,
'configuration_name': import_configuration_location,
'interface': interface}))
@ -446,7 +446,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
if not system.managers:
raise exception.DracOperationError(
error=(_("No managers found for %(node)s"),
error=(_("No managers found for %(node)s") %
{'node': task.node.uuid}))
for manager in system.managers:
@ -492,7 +492,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
continue
raise exception.DracOperationError(
error=(_("Failed to import configuration for node %(node)s"),
error=(_("Failed to import configuration for node %(node)s") %
{'node': task.node.uuid}))
@base.clean_step(priority=0,


+ 8
- 16
ironic/tests/unit/drivers/modules/drac/test_management.py View File

@ -851,8 +851,7 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
@mock.patch.object(redfish_utils, 'get_system', autospec=True)
def test_export_configuration_no_managers(self, mock_get_system):
task = mock.Mock(node=self.node, context=self.context)
fake_system = mock.Mock(managers=[])
mock_get_system.return_value = fake_system
mock_get_system.return_value.managers = []
self.assertRaises(exception.DracOperationError,
self.management.export_configuration, task, 'edge')
@ -865,8 +864,7 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
fake_manager1 = mock.Mock()
fake_manager1.get_oem_extension.side_effect = (
sushy.exceptions.OEMExtensionNotFoundError)
fake_system = mock.Mock(managers=[fake_manager1])
mock_get_system.return_value = fake_system
mock_get_system.return_value.managers = [fake_manager1]
self.assertRaises(exception.RedfishError,
self.management.export_configuration, task, 'edge')
@ -887,8 +885,7 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
sushy.exceptions.SushyError)
fake_manager2 = mock.Mock()
fake_manager2.get_oem_extension.return_value = fake_manager_oem2
fake_system = mock.Mock(managers=[fake_manager1, fake_manager2])
mock_get_system.return_value = fake_system
mock_get_system.return_value.managers = [fake_manager1, fake_manager2]
self.assertRaises(exception.DracOperationError,
self.management.export_configuration,
@ -903,8 +900,7 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
fake_manager_oem1.export_system_configuration.status_code = 500
fake_manager1 = mock.Mock()
fake_manager1.get_oem_extension.return_value = fake_manager_oem1
fake_system = mock.Mock(managers=[fake_manager1])
mock_get_system.return_value = fake_system
mock_get_system.return_value.managers = [fake_manager1]
self.assertRaises(exception.DracOperationError,
self.management.export_configuration, task, 'edge')
@ -930,8 +926,7 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
configuration)
fake_manager2 = mock.Mock()
fake_manager2.get_oem_extension.return_value = fake_manager_oem2
fake_system = mock.Mock(managers=[fake_manager1, fake_manager2])
mock_get_system.return_value = fake_system
mock_get_system.return_value.managers = [fake_manager1, fake_manager2]
self.management.export_configuration(task, 'edge')
mock_save_configuration.assert_called_once_with(
@ -1006,8 +1001,7 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
sushy.exceptions.SushyError)
fake_manager2 = mock.Mock()
fake_manager2.get_oem_extension.return_value = fake_manager_oem2
fake_system = mock.Mock(managers=[fake_manager1, fake_manager2])
mock_get_system.return_value = fake_system
mock_get_system.return_value.managers = [fake_manager1, fake_manager2]
mock_get_configuration.return_value = json.loads(
'{"oem": {"interface": "idrac-redfish", '
'"data": {"prop1": "value1", "prop2": 2}}}')
@ -1024,8 +1018,7 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
fake_manager_oem1 = mock.Mock()
fake_manager1 = mock.Mock()
fake_manager1.get_oem_extension.return_value = fake_manager_oem1
fake_system = mock.Mock(managers=[fake_manager1])
mock_get_system.return_value = fake_system
mock_get_system.return_value.managers = [fake_manager1]
mock_get_configuration.return_value = json.loads(
'{"oem": {"interface": "idrac-wsman", '
'"data": {"prop1": "value1", "prop2": 2}}}')
@ -1058,8 +1051,7 @@ class DracRedfishManagementTestCase(test_utils.BaseDracTest):
fake_manager_oem2 = mock.Mock()
fake_manager2 = mock.Mock()
fake_manager2.get_oem_extension.return_value = fake_manager_oem2
fake_system = mock.Mock(managers=[fake_manager1, fake_manager2])
mock_get_system.return_value = fake_system
mock_get_system.return_value.managers = [fake_manager1, fake_manager2]
mock_get_configuration.return_value = json.loads(
'{"oem": {"interface": "idrac-redfish", '
'"data": {"prop1": "value1", "prop2": 2}}}')


Loading…
Cancel
Save