Skip to content

Commit

Permalink
Merge pull request #5 from medicalwei/rp-hacky-fixes
Browse files Browse the repository at this point in the history
Fixing some fixes regarding to RP
  • Loading branch information
mwhudson authored Aug 14, 2023
2 parents 92f793e + 9c37efd commit eb40871
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
24 changes: 12 additions & 12 deletions subiquity/server/controllers/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ async def run_curtin_step(name, stages, step_config, source=None):
casper_uuid = fp.read().strip()
rp_partuuid = self.app.kernel_cmdline.get("rp-partuuid")
if casper_uuid is not None and rp_partuuid is not None:
rp = self.app.base_model.partition_by_partuuid(rp_partuuid)
rp = self.app.base_model.filesystem.partition_by_partuuid(rp_partuuid)
if rp is not None:
await self.configure_rp_boot(
context=context, rp=rp, casper_uuid=casper_uuid
Expand Down Expand Up @@ -499,16 +499,16 @@ async def configure_rp_boot_grub(self, context, rp: Partition, casper_uuid: str)
with open(self.tpath("etc/grub.d/99_reset"), "w") as fp:
os.chmod(fp.fileno(), 0o755)
fp.write(conf)
await run_curtin_command(
self.app,
context,
"in-target",
"-t",
self.tpath(),
"--",
"update-grub",
private_mounts=False,
)
await run_curtin_command(
self.app,
context,
"in-target",
"-t",
self.tpath(),
"--",
"update-grub",
private_mounts=False,
)

@with_context(description="configuring UEFI menu entry for factory reset")
async def configure_rp_boot_uefi(self, context, rp: Partition):
Expand Down Expand Up @@ -557,7 +557,7 @@ async def configure_rp_boot_uefi(self, context, rp: Partition):
cmd = [
"efibootmgr",
"--bootorder",
",".join(efi_state_before.order),
",".join(efi_state_before.order + [new_bootnum]),
]
rp_bootnum = new_bootnum
await self.app.command_runner.run(cmd)
Expand Down
11 changes: 9 additions & 2 deletions subiquity/server/controllers/tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ async def test_configure_rp_boot_uefi_add(self, m_get_efibootmgr):
[
"efibootmgr",
"--bootorder",
"0000,0002",
"0000,0002,0003",
]
),
]
Expand Down Expand Up @@ -295,7 +295,14 @@ async def test_configure_rp_boot_uefi_bootnext(self, m_get_efibootmgr):
[
"efibootmgr",
"--bootorder",
"0000,0002",
"0000,0002,0003",
]
),
call(
[
"efibootmgr",
"--bootnext",
"0003",
]
),
]
Expand Down

0 comments on commit eb40871

Please sign in to comment.