Fixes error handling if efibootmgr is not present in ramdisk
Change-Id: I8edff252e72cb91282f8984cd6935f39cd744cfe Story: 2007324 Task: 38842
This commit is contained in:
parent
add4d03349
commit
823a7cd9db
@ -520,7 +520,7 @@ class ImageExtension(base.BaseAgentExtension):
|
|||||||
has_efibootmgr = True
|
has_efibootmgr = True
|
||||||
try:
|
try:
|
||||||
utils.execute('efibootmgr', '--version')
|
utils.execute('efibootmgr', '--version')
|
||||||
except errors.CommandExecutionError:
|
except FileNotFoundError:
|
||||||
LOG.warning("efibootmgr is not available in the ramdisk")
|
LOG.warning("efibootmgr is not available in the ramdisk")
|
||||||
has_efibootmgr = False
|
has_efibootmgr = False
|
||||||
|
|
||||||
|
@ -293,6 +293,21 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
|
|||||||
prep_boot_part_uuid=self.fake_prep_boot_part_uuid)
|
prep_boot_part_uuid=self.fake_prep_boot_part_uuid)
|
||||||
mock_iscsi_clean.assert_called_once_with(self.fake_dev)
|
mock_iscsi_clean.assert_called_once_with(self.fake_dev)
|
||||||
|
|
||||||
|
@mock.patch.object(os.path, 'exists', lambda *_: False)
|
||||||
|
@mock.patch.object(iscsi, 'clean_up', autospec=True)
|
||||||
|
def test_install_bootloader_failure(self, mock_iscsi_clean, mock_execute,
|
||||||
|
mock_dispatch):
|
||||||
|
mock_dispatch.side_effect = [
|
||||||
|
self.fake_dev, hardware.BootInfo(current_boot_mode='uefi')
|
||||||
|
]
|
||||||
|
mock_execute.side_effect = FileNotFoundError
|
||||||
|
self.assertRaises(FileNotFoundError,
|
||||||
|
self.agent_extension.install_bootloader,
|
||||||
|
root_uuid=self.fake_root_uuid,
|
||||||
|
efi_system_part_uuid=None)
|
||||||
|
expected = [mock.call('efibootmgr', '--version')]
|
||||||
|
mock_execute.assert_has_calls(expected)
|
||||||
|
|
||||||
@mock.patch.object(image, '_is_bootloader_loaded', lambda *_: False)
|
@mock.patch.object(image, '_is_bootloader_loaded', lambda *_: False)
|
||||||
@mock.patch.object(hardware, 'is_md_device', autospec=True)
|
@mock.patch.object(hardware, 'is_md_device', autospec=True)
|
||||||
@mock.patch.object(hardware, 'md_get_raid_devices', autospec=True)
|
@mock.patch.object(hardware, 'md_get_raid_devices', autospec=True)
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes error handling if efibootmgr is not present in ramdisk.
|
||||||
|
See `story <https://storyboard.openstack.org/#!/story/2007324>`_
|
||||||
|
for more details.
|
Loading…
x
Reference in New Issue
Block a user