diff options
| author | Steve Baker <sbaker@redhat.com> | 2021-06-03 13:16:55 +1200 |
|---|---|---|
| committer | Steve Baker <sbaker@redhat.com> | 2021-06-04 10:03:55 +1200 |
| commit | a057be7dadc898ec813b2cac14913cd8523fbbcc (patch) | |
| tree | 20aa6fd08a1e9f1e24471d89bf20ac8bf1241abc /ironic_python_agent/tests/unit | |
| parent | 5c063c8224d3d3e69a1e10f2252e2eebdcceffb1 (diff) | |
| download | ironic-python-agent-a057be7dadc898ec813b2cac14913cd8523fbbcc.tar.gz | |
Ignore efi grub2-install failure
Recent releases of redhat grub2 will always fail when installing to
EFI paths, to encourage a transition to the signed shim bootloader.
Partition image deploys avoid calling grub2-install with the
preserve-efi-assets functions. Deploying whole disk images doesn't
require grub2-install. This leaves whole disk images installed onto
softraid devices, which still attempts to call grub2-install.
This change will still attempt to run grub2-install in this
one remaining case, but will ignore any failure.
A future enhancement can avoid calling grub2-install entirely so that
non-redhat secure-boot capable images can keep their signed
bootloaders.
Story: 2008923
Task: 42521
Change-Id: If432ef795d64d76442d739eb4f7d155ff847041e
Diffstat (limited to 'ironic_python_agent/tests/unit')
| -rw-r--r-- | ironic_python_agent/tests/unit/extensions/test_image.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/ironic_python_agent/tests/unit/extensions/test_image.py b/ironic_python_agent/tests/unit/extensions/test_image.py index e2b633a7..599a1973 100644 --- a/ironic_python_agent/tests/unit/extensions/test_image.py +++ b/ironic_python_agent/tests/unit/extensions/test_image.py @@ -1675,6 +1675,21 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n mock_is_md_device, mock_execute, mock_dispatch): + # return success for every execute call + mock_execute.side_effect = [('', '')] * 21 + + # make grub2-install calls fail + grub_failure = processutils.ProcessExecutionError( + stdout='', + stderr='grub2-install: error: this utility cannot be used ' + 'for EFI platforms because it does not support ' + 'UEFI Secure Boot.\n', + exit_code=1, + cmd='grub2-install' + ) + mock_execute.side_effect[9] = grub_failure + mock_execute.side_effect[10] = grub_failure + mock_get_part_uuid.side_effect = [self.fake_root_part, self.fake_efi_system_part] environ_mock.get.return_value = '/sbin' @@ -1686,7 +1701,10 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n efi_system_part_uuid=self.fake_efi_system_part_uuid, target_boot_mode='uefi') - expected = [mock.call('mount', '/dev/fake2', self.fake_dir), + expected = [mock.call('partx', '-u', '/dev/fake', attempts=3, + delay_on_retry=True), + mock.call('udevadm', 'settle'), + mock.call('mount', '/dev/fake2', self.fake_dir), mock.call('mount', '-o', 'bind', '/dev', self.fake_dir + '/dev'), mock.call('mount', '-o', 'bind', '/proc', |
