Skip to content

Commit

Permalink
kernel: migrate to remove: existing
Browse files Browse the repository at this point in the history
  • Loading branch information
dbungert committed Sep 18, 2024
1 parent 6b312fc commit 3c2e8b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
36 changes: 18 additions & 18 deletions subiquity/models/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def needed_kernel(self) -> Optional[str]:
# Newer ISOs may have the wrong kernel pre-installed, so we need to
# install the correct kernel and remove the pre-installed one. We
# continue to rely on curtin for kernel installation, with the addition
# of support to remove the pre-installed kernel. remove_existing does
# the right thing here.
# of support to remove the pre-installed kernel. `remove: existing`
# does the right thing here.
# 3. yes preinstall, preinstalled kernel is right, no OEM kernel:
# Almost identical to case #2 but this time the preinstall is correct.
# This is the happy path and a noticeably faster install time. From the
Expand All @@ -80,23 +80,23 @@ def needed_kernel(self) -> Optional[str]:

# Handling:
# 1. no preinstall, no OEM kernel:
# use "package" to specify the desired package, we set "remove_existing"
# but it has nothing to do, so nothing is removed. Curtin carries out
# the actual kernel install.
# config: {"package": "foo", "remove_existing": True}
# use "package" to specify the desired package, we set
# `remove: existing` but it has nothing to do, so nothing is removed.
# Curtin carries out the actual kernel install.
# config: {"package": "foo", "remove": "existing"}
# 2. yes preinstall, preinstalled kernel is wrong, no OEM kernel:
# use "package" to specify the desired package, we set "remove_existing"
# and this time it has a pre-installed package to remove. Same config
# as #1, but curtin determines a package does need to be removed and
# does so.
# config: {"package": "foo", "remove_existing": True}
# use "package" to specify the desired package, we set
# `remove: existing` and this time it has a pre-installed package to
# remove. Same config as #1, but curtin determines a package does need
# to be removed and does so.
# config: {"package": "foo", "remove": "existing"}
# 3. yes preinstall, preinstalled kernel is right, no OEM kernel:
# use "package" to specify the desired package, we set "remove_existing"
# like before. Same config as #1/#2, but curtin detects via
# ensure_one_kernel that the installed kernel state before/after
# installing the requested package is unchanged, so no kernel is
# removed.
# config: {"package": "foo", "remove_existing": True}
# use "package" to specify the desired package, we set
# `remove: existing` like before. Same config as #1/#2, but curtin
# detects via ensure_one_kernel that the installed kernel state
# before/after installing the requested package is unchanged, so no
# kernel is removed.
# config: {"package": "foo", "remove": "existing"}
# 4. no preinstall, yes OEM kernel:
# This time Subiquity is managing the kernel install, curtin should not
# install anything, and curtin's ensure_one_kernel would do the right
Expand Down Expand Up @@ -134,5 +134,5 @@ def render(self):
if bool(self.remove):
kernel["remove"] = self.remove
else:
kernel["remove_existing"] = True
kernel["remove"] = "existing"
return {"kernel": kernel}
4 changes: 2 additions & 2 deletions subiquity/models/tests/test_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def testInstall(self):
expected = {
"kernel": {
"package": "kernel-a",
"remove_existing": True,
"remove": "existing",
}
}

Expand All @@ -40,7 +40,7 @@ def testNoInstall(self):
expected = {
"kernel": {
"install": False,
"remove_existing": True,
"remove": "existing",
}
}

Expand Down

0 comments on commit 3c2e8b6

Please sign in to comment.