Merge ~jocave/plainbox-provider-resource:bootloader-error-handling into plainbox-provider-resource:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Jonathan Cave
Approved revision: 8b8e139fb1ca11604852d85a62faf23fc322b7af
Merged at revision: cb370b9745da62272bb03cd90d775eb8b3f4933c
Proposed branch: ~jocave/plainbox-provider-resource:bootloader-error-handling
Merge into: plainbox-provider-resource:master
Diff against target: 29 lines (+17/-1)
1 file modified
bin/bootloader_resource.py (+17/-1)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+378327@code.launchpad.net

Description of the change

Improve bootloader_resource.py when running on classic systems and when the BOOT_IMAGE variable does not contain a bracketed variable.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

(11:27:53 AM) spineau: joc: how can I test it, just classic?
(11:31:55 AM) spineau: joc: '(hd1,gpt1)' looks a bit restrictive. could we wee a system with for example hd0, gpt2 ?
(11:32:03 AM) spineau: wee/see
(11:32:18 AM) joc: i have no idea
(11:32:27 AM) joc: this is a question for the delivery team i think
(11:35:47 AM) spineau: joc: I'm ok to land and revisit the rule when a new project will come and fail with an 'unknown' grub_path. If it solves fortknox that's already an improvement

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bin/bootloader_resource.py b/bin/bootloader_resource.py
index dd9b995..5088218 100755
--- a/bin/bootloader_resource.py
+++ b/bin/bootloader_resource.py
@@ -52,7 +52,23 @@ def booted_kernel_location(bl_name):
52 cmdline = f.readline()52 cmdline = f.readline()
53 result = parse_kernel_cmdline(cmdline)53 result = parse_kernel_cmdline(cmdline)
54 grub_path = result.params['BOOT_IMAGE']54 grub_path = result.params['BOOT_IMAGE']
55 path = os.path.join('/boot/efi', grub_path[grub_path.index(')')+2:])55
56 # The BOOT_IMAGE parameter is tricky to decipher. It can be absolute
57 # path or refer or contain a variable expanded by ... initramfs?
58 if os.path.isabs(grub_path):
59 path = grub_path
60 else:
61 try:
62 # if we know where the parameter is referencing, replace it
63 if '(loop)' in grub_path:
64 # implies of out of the kernel snap (so no FDE)
65 pass
66 elif '(hd1,gpt1)' in grub_path:
67 # used by fortknox
68 path = os.path.join(
69 '/boot/efi', grub_path[grub_path.index(')')+2:])
70 except ValueError:
71 pass
56 elif bl_name == 'androidboot':72 elif bl_name == 'androidboot':
57 pass73 pass
58 elif bl_name == 'lk':74 elif bl_name == 'lk':

Subscribers

People subscribed via source and target branches