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

kernel: migrate to remove: existing #2086

Merged
merged 3 commits into from
Sep 19, 2024
Merged
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
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
Loading