Skip to content

Commit

Permalink
Merge pull request #2086 from dbungert/more-kernel
Browse files Browse the repository at this point in the history
kernel: migrate to `remove: existing`
  • Loading branch information
dbungert authored Sep 19, 2024
2 parents 95ccb9c + 3c2e8b6 commit 24b1480
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ parts:

source: https://git.launchpad.net/curtin
source-type: git
source-commit: 40cae5c60fa9f4c495c7f61cde28862175f93ce2
source-commit: "8aa0a9709d280f526c9a7cd62cffb53575a3a5e7"

override-pull: |
craftctl default
Expand Down Expand Up @@ -229,7 +229,7 @@ parts:

source: https://github.com/canonical/probert.git
source-type: git
source-commit: 83d25c873a4a7d93c158d76da86cb9c612c29572
source-commit: "83d25c873a4a7d93c158d76da86cb9c612c29572"

override-build: *pyinstall

Expand Down
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 24b1480

Please sign in to comment.