Merge ~jocave/plainbox-provider-resource:bootloader-classic-support into plainbox-provider-resource:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Jonathan Cave
Approved revision: 23573e18b15e0f4f166f8a2493f41a2e66eb58e3
Merged at revision: 33eb4aaadd64faaa9bad61e0930631db978d08f4
Proposed branch: ~jocave/plainbox-provider-resource:bootloader-classic-support
Merge into: plainbox-provider-resource:master
Diff against target: 28 lines (+3/-2)
1 file modified
bin/bootloader_resource.py (+3/-2)
Reviewer Review Type Date Requested Status
Sheila Miguez (community) Approve
Review via email: mp+392003@code.launchpad.net

Description of the change

get_series() was only intended to be used on Ubuntu Core systems. However, the function will return something that is not convertible to an int on classic systems and cause an exception.

To post a comment you must log in.
Revision history for this message
Sheila Miguez (codersquid) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/bootloader_resource.py b/bin/bootloader_resource.py
2index 464928f..26eec3d 100755
3--- a/bin/bootloader_resource.py
4+++ b/bin/bootloader_resource.py
5@@ -23,12 +23,13 @@ from checkbox_support.parsers.kernel_cmdline import parse_kernel_cmdline
6 from checkbox_support.snap_utils.system import get_lk_bootimg_path
7 from checkbox_support.snap_utils.system import add_hostfs_prefix
8 from checkbox_support.snap_utils.system import get_series
9+from checkbox_support.snap_utils.system import on_ubuntucore
10
11
12 # Supported bootloaders and detected files taken from:
13 # https://github.com/snapcore/snapd/blob/master/bootloader/bootloader.go
14 # name = [root dir, config file]
15-if int(get_series()) >= 20:
16+if on_ubuntucore() and int(get_series()) >= 20:
17 bootloaders = {
18 'uboot': ['/boot/uboot', 'boot.sel'],
19 'grub': ['/boot/grub', 'grub.cfg'],
20@@ -62,7 +63,7 @@ def booted_kernel_location(bl_name):
21 If either is not indentifiable currently use value 'unknown'.
22 """
23 if bl_name == 'grub':
24- if int(get_series()) >= 20:
25+ if on_ubuntucore() and int(get_series()) >= 20:
26 symlink = '/boot/grub/kernel.efi'
27 prefixed = add_hostfs_prefix(symlink)
28 path = os.path.realpath(prefixed)

Subscribers

People subscribed via source and target branches