diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2021-01-08 17:57:56 +0100 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2021-01-19 17:56:06 +0100 |
commit | b6f4587f0bdfc2f4b5736db1c9f89639ef2e09a7 (patch) | |
tree | fb537867eded3c171686df7ca5b5cd41d00fff5e /ironic/tests/unit/drivers/modules/test_pxe.py | |
parent | d35eb8bd0e401f659fa4190ea875251ff841a345 (diff) | |
download | ironic-b6f4587f0bdfc2f4b5736db1c9f89639ef2e09a7.tar.gz |
Common framework for configuring secure boot
Two drivers already support turning secore boot on and off,
Redfish will follow soon. This patch adds ManagementInterface
calls to get and set the secure boot state.
Story: #2008270
Task: #41561
Change-Id: I96b2697163def52618b4c051a5c85adf7d1818a5
Diffstat (limited to 'ironic/tests/unit/drivers/modules/test_pxe.py')
-rw-r--r-- | ironic/tests/unit/drivers/modules/test_pxe.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ironic/tests/unit/drivers/modules/test_pxe.py b/ironic/tests/unit/drivers/modules/test_pxe.py index 5c7542402..1ccc33699 100644 --- a/ironic/tests/unit/drivers/modules/test_pxe.py +++ b/ironic/tests/unit/drivers/modules/test_pxe.py @@ -35,6 +35,7 @@ from ironic.conductor import task_manager from ironic.conductor import utils as manager_utils from ironic.drivers import base as drivers_base from ironic.drivers.modules import agent_base +from ironic.drivers.modules import boot_mode_utils from ironic.drivers.modules import deploy_utils from ironic.drivers.modules import fake from ironic.drivers.modules import ipxe @@ -694,10 +695,13 @@ class PXEBootTestCase(db_base.DbTestCase): set_boot_device_mock.assert_called_once_with( task, boot_devices.DISK, persistent=True) + @mock.patch.object(boot_mode_utils, 'configure_secure_boot_if_needed', + autospec=True) @mock.patch.object(manager_utils, 'node_set_boot_device', autospec=True) @mock.patch.object(pxe_utils, 'clean_up_pxe_config', autospec=True) def test_prepare_instance_localboot(self, clean_up_pxe_config_mock, - set_boot_device_mock): + set_boot_device_mock, + secure_boot_mock): with task_manager.acquire(self.context, self.node.uuid) as task: instance_info = task.node.instance_info instance_info['capabilities'] = {'boot_option': 'local'} @@ -709,6 +713,7 @@ class PXEBootTestCase(db_base.DbTestCase): set_boot_device_mock.assert_called_once_with(task, boot_devices.DISK, persistent=True) + secure_boot_mock.assert_called_once_with(task) @mock.patch.object(manager_utils, 'node_set_boot_device', autospec=True) @mock.patch.object(pxe_utils, 'clean_up_pxe_config', autospec=True) @@ -784,10 +789,13 @@ class PXEBootTestCase(db_base.DbTestCase): def test_prepare_instance_ramdisk_pxe_conf_exists(self): self._test_prepare_instance_ramdisk(config_file_exits=False) + @mock.patch.object(boot_mode_utils, 'deconfigure_secure_boot_if_needed', + autospec=True) @mock.patch.object(pxe_utils, 'clean_up_pxe_env', autospec=True) @mock.patch.object(pxe_utils, 'get_instance_image_info', autospec=True) def test_clean_up_instance(self, get_image_info_mock, - clean_up_pxe_env_mock): + clean_up_pxe_env_mock, + secure_boot_mock): with task_manager.acquire(self.context, self.node.uuid) as task: image_info = {'kernel': ['', '/path/to/kernel'], 'ramdisk': ['', '/path/to/ramdisk']} @@ -797,6 +805,7 @@ class PXEBootTestCase(db_base.DbTestCase): ipxe_enabled=False) get_image_info_mock.assert_called_once_with(task, ipxe_enabled=False) + secure_boot_mock.assert_called_once_with(task) class PXERamdiskDeployTestCase(db_base.DbTestCase): |