Merge ~raharper/curtin:fix/eoan-disable-kernel-img-conf into curtin:master

Proposed by Ryan Harper on 2019-10-17
Status: Merged
Approved by: Dan Watkins on 2019-10-24
Approved revision: a76b74e64ec7f0536a18b5d4e17fde7f21334575
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/curtin:fix/eoan-disable-kernel-img-conf
Merge into: curtin:master
Diff against target: 67 lines (+27/-0)
3 files modified
curtin/commands/curthooks.py (+5/-0)
tests/unittests/test_curthooks.py (+19/-0)
tests/vmtests/__init__.py (+3/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve on 2019-10-21
Dan Watkins 2019-10-17 Approve on 2019-10-18
Review via email: mp+374320@code.launchpad.net

Commit message

curthooks: skip setup_kernel_img_conf on eoan and newer

In Eoan, link_in_boot is the default so curtin no longer needs
to generate a kernel-img.conf controlling link_in_boot.

LP: #1847257

To post a comment you must log in.
Dan Watkins (daniel-thewatkins) wrote :

A couple of nits inline, and one question for my own edification. Nothing blocking, though, so +1 and will leave you to land with/without the nits addressed.

review: Approve
029aeeb... by Ryan Harper on 2019-10-18

Compare tuple of integers instead of floats

a76b74e... by Ryan Harper on 2019-10-18

Add bug reference to SkipTest message

Ryan Harper (raharper) :
Ryan Harper (raharper) wrote :

Added a comment about curthooks in general.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/commands/curthooks.py b/curtin/commands/curthooks.py
2index 478ce26..edbaddf 100644
3--- a/curtin/commands/curthooks.py
4+++ b/curtin/commands/curthooks.py
5@@ -262,6 +262,11 @@ def get_flash_kernel_pkgs(arch=None, uefi=None):
6
7
8 def setup_kernel_img_conf(target):
9+ # kernel-img.conf only needed on release prior to 19.10
10+ lsb_info = distro.lsb_release(target=target)
11+ if tuple(map(int, lsb_info['release'].split('.'))) >= (19, 10):
12+ return
13+
14 kernel_img_conf_vars = {
15 'bootloader': 'no',
16 'inboot': 'yes',
17diff --git a/tests/unittests/test_curthooks.py b/tests/unittests/test_curthooks.py
18index 613f068..ceab906 100644
19--- a/tests/unittests/test_curthooks.py
20+++ b/tests/unittests/test_curthooks.py
21@@ -130,6 +130,11 @@ class TestSetupKernelImgConf(CiTestCase):
22 self.add_patch('curtin.util.get_architecture', 'mock_arch')
23 self.add_patch('curtin.util.write_file', 'mock_write_file')
24 self.target = 'not-a-real-target'
25+ self.add_patch('curtin.distro.lsb_release', 'mock_lsb_release')
26+ self.mock_lsb_release.return_value = {
27+ 'codename': 'xenial',
28+ 'release': '16.04',
29+ }
30
31 def test_on_s390x(self):
32 self.mock_machine.return_value = "s390x"
33@@ -173,6 +178,20 @@ do_initrd = yes
34 link_in_boot = no
35 """)
36
37+ def test_skips_on_eoan_or_newer(self):
38+ test_releases = [('eoan', '19.10'), ('ff', '20.04')]
39+ test_params = [
40+ ('s390x', 's390x'), ('i686', 'i386'), ('x86_64', 'amd64')]
41+ for code, rel in test_releases:
42+ self.mock_lsb_release.return_value = {
43+ 'codename': code, 'release': rel
44+ }
45+ for machine, arch in test_params:
46+ self.mock_machine.return_value = machine
47+ self.mock_arch.return_value = arch
48+ curthooks.setup_kernel_img_conf(self.target)
49+ self.assertEqual(0, self.mock_write_file.call_count)
50+
51
52 class TestInstallMissingPkgs(CiTestCase):
53 def setUp(self):
54diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py
55index 3119a40..5a79d13 100644
56--- a/tests/vmtests/__init__.py
57+++ b/tests/vmtests/__init__.py
58@@ -1725,6 +1725,9 @@ class VMBaseClass(TestCase):
59 """ Test curtin install kernel-img.conf correctly. """
60 if self.target_distro != 'ubuntu':
61 raise SkipTest("kernel-img.conf not needed in non-ubuntu releases")
62+ if self.target_release not in ['trusty', 'xenial', 'bionic', 'disco']:
63+ raise SkipTest(
64+ "LP: #1847257 kernel-img.conf not needed in eoan and newer")
65 kconf = 'kernel-img.conf'
66 self.output_files_exist([kconf])
67 if self.target_arch in ['i386', 'amd64']:

Subscribers

People subscribed via source and target branches