Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHEL 9: bootupd update firmware #5760

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pyanaconda/modules/payloads/payload/rpm_ostree/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,22 @@ def _install_bootupd(self):
device_tree = STORAGE.get_proxy(DEVICE_TREE)
dev_data = DeviceData.from_structure(device_tree.GetDeviceData(bootloader.Drive))

bootupdctl_args = [
"--auto",
"--write-uuid",
]

# do not insert UEFI entry if leavebootorder was requested
if not bootloader.KeepBootOrder:
log.debug("Adding --update-firmware to bootupdctl call")
bootupdctl_args.append("--update-firmware")

rc = execWithRedirect(
"bootupctl",
[
"backend",
"install",
"--auto",
"--write-uuid",
*bootupdctl_args,
"--device",
dev_data.path,
"/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ def test_bootupd_run(self, devdata_mock, storage_mock, symlink_mock, rename_mock
proxy_mock.GetFstabSpec.return_value = "FSTAB-SPEC"
proxy_mock.GetRootDevice.return_value = "device-name"
proxy_mock.Drive = "btldr-drv"
proxy_mock.KeepBootOrder = False
devdata_mock.from_structure.return_value.type = "something-non-btrfs-subvolume-ish"
devdata_mock.from_structure.return_value.path = "/dev/btldr-drv"

Expand All @@ -694,8 +695,50 @@ def test_bootupd_run(self, devdata_mock, storage_mock, symlink_mock, rename_mock
exec_mock.assert_has_calls([
call(
"bootupctl",
["backend", "install", "--auto", "--write-uuid", "--device",
"/dev/btldr-drv", "/"],
["backend", "install", "--auto", "--write-uuid", "--update-firmware",
"--device", "/dev/btldr-drv", "/"],
root=sysroot
),
call(
"ostree",
["admin", "instutil", "set-kargs", "BOOTLOADER-ARGS", "root=FSTAB-SPEC", "rw"],
root=sysroot
)
])

@patch("pyanaconda.modules.payloads.payload.rpm_ostree.installation.have_bootupd")
@patch("pyanaconda.modules.payloads.payload.rpm_ostree.installation.execWithRedirect")
@patch("pyanaconda.modules.payloads.payload.rpm_ostree.installation.os.rename")
@patch("pyanaconda.modules.payloads.payload.rpm_ostree.installation.os.symlink")
@patch("pyanaconda.modules.payloads.payload.rpm_ostree.installation.STORAGE")
@patch("pyanaconda.modules.payloads.payload.rpm_ostree.installation.DeviceData")
def test_bootupd_run_with_leavebootorder(self, devdata_mock, storage_mock, symlink_mock,
rename_mock, exec_mock, have_bootupd_mock):
"""Test OSTree bootloader config task, bootupd"""
exec_mock.return_value = 0
have_bootupd_mock.return_value = True

proxy_mock = storage_mock.get_proxy()
proxy_mock.GetArguments.return_value = ["BOOTLOADER-ARGS"]
proxy_mock.GetFstabSpec.return_value = "FSTAB-SPEC"
proxy_mock.GetRootDevice.return_value = "device-name"
proxy_mock.Drive = "btldr-drv"
proxy_mock.KeepBootOrder = True
devdata_mock.from_structure.return_value.type = "something-non-btrfs-subvolume-ish"
devdata_mock.from_structure.return_value.path = "/dev/btldr-drv"

with tempfile.TemporaryDirectory() as sysroot:
task = ConfigureBootloader(sysroot, is_dirinstall=False)
task.run()

rename_mock.assert_not_called()
symlink_mock.assert_not_called()
assert exec_mock.call_count == 2
exec_mock.assert_has_calls([
call(
"bootupctl",
["backend", "install", "--auto", "--write-uuid",
"--device", "/dev/btldr-drv", "/"],
root=sysroot
),
call(
Expand Down
Loading