Merge lp:~ltrager/maas-images/centos7_uefi into lp:maas-images

Proposed by Lee Trager
Status: Merged
Merged at revision: 360
Proposed branch: lp:~ltrager/maas-images/centos7_uefi
Merge into: lp:maas-images
Diff against target: 107 lines (+10/-43)
3 files modified
conf/centos.yaml (+2/-0)
curtin/centos7/curtin-hooks.py (+7/-43)
meph2/ubuntu_info.py (+1/-0)
To merge this branch: bzr merge lp:~ltrager/maas-images/centos7_uefi
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+323099@code.launchpad.net

Commit message

Fix CentOS 7 Curtin hook when deploying to a UEFI AMD64 system

Description of the change

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

lgtm! Tested, works just fine!

review: Approve
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Actually, questions inline:

review: Needs Information
Revision history for this message
Andres Rodriguez (andreserl) wrote :

question was answered on IRC, so i'm good with his.

12:47 < blake_r> roaksoax: you don't need that stuff
12:47 < roaksoax> blake_r: why not ?
12:47 < blake_r> roaksoax: because its now mounted by default
12:47 < roaksoax> ok, you maen grub/curtin/the os handles that ?
12:47 < blake_r> yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'conf/centos.yaml'
2--- conf/centos.yaml 2016-09-17 00:28:38 +0000
3+++ conf/centos.yaml 2017-04-25 08:12:18 +0000
4@@ -20,6 +20,8 @@
5 # EPEL7-testing
6 - https://kojipkgs.fedoraproject.org/packages/python-oauth/1.0.1/10.el7/noarch/python-oauth-1.0.1-10.el7.noarch.rpm
7 - linux-firmware
8+ - grub2-efi-modules
9+ - efibootmgr
10 centos66:
11 version: 6.6
12 release_title: "CentOS 6.6"
13
14=== modified file 'curtin/centos7/curtin-hooks.py'
15--- curtin/centos7/curtin-hooks.py 2016-05-11 18:47:46 +0000
16+++ curtin/centos7/curtin-hooks.py 2017-04-25 08:12:18 +0000
17@@ -9,7 +9,6 @@
18 import codecs
19 import os
20 import sys
21-import shutil
22
23 from curtin import (
24 block,
25@@ -72,14 +71,6 @@
26 return blocks[rootdev]
27
28
29-def get_uefi_partition():
30- """Return the UEFI partition."""
31- for _, value in block._lsblock().items():
32- if value['LABEL'] == 'uefi-boot':
33- return value
34- return None
35-
36-
37 def read_file(path):
38 """Returns content of a file."""
39 with codecs.open(path, encoding='utf-8') as stream:
40@@ -152,36 +143,13 @@
41 in_chroot(['grub2-mkconfig', '-o', '/boot/grub2/grub.cfg'])
42
43
44-def install_efi(target, uefi_path):
45+def install_uefi(target):
46 """Install the EFI data from /boot into efi partition."""
47- # Create temp mount point for uefi partition.
48- tmp_efi = os.path.join(target, 'boot', 'efi_part')
49- os.mkdir(tmp_efi)
50- util.subp(['mount', uefi_path, tmp_efi])
51-
52- # Copy the data over.
53- try:
54- efi_path = os.path.join(target, 'boot', 'efi')
55- if os.path.exists(os.path.join(tmp_efi, 'EFI')):
56- shutil.rmtree(os.path.join(tmp_efi, 'EFI'))
57- shutil.copytree(
58- os.path.join(efi_path, 'EFI'),
59- os.path.join(tmp_efi, 'EFI'))
60- finally:
61- # Clean up tmp mount
62- util.subp(['umount', tmp_efi])
63- os.rmdir(tmp_efi)
64-
65- # Mount and do grub install
66- util.subp(['mount', uefi_path, efi_path])
67- try:
68- with util.RunInChroot(target) as in_chroot:
69- in_chroot([
70- 'grub2-install', '--target=x86_64-efi',
71- '--efi-directory', '/boot/efi',
72- '--recheck'])
73- finally:
74- util.subp(['umount', efi_path])
75+ with util.RunInChroot(target) as in_chroot:
76+ in_chroot([
77+ 'grub2-install', '--target=x86_64-efi',
78+ '--efi-directory', '/boot/efi',
79+ '--recheck'])
80
81
82 def set_autorelabel(target):
83@@ -315,11 +283,7 @@
84 target, extra=get_extra_kernel_parameters())
85 grub2_mkconfig(target)
86 if util.is_uefi_bootable():
87- uefi_part = get_uefi_partition()
88- if uefi_part is None:
89- print('Unable to determine UEFI parition.')
90- sys.exit(1)
91- install_efi(target, uefi_part['device_path'])
92+ install_uefi(target)
93 else:
94 for dev in devices:
95 grub2_install(target, dev)
96
97=== modified file 'meph2/ubuntu_info.py'
98--- meph2/ubuntu_info.py 2016-04-25 20:07:36 +0000
99+++ meph2/ubuntu_info.py 2017-04-25 08:12:18 +0000
100@@ -96,6 +96,7 @@
101 try:
102 devel = udi.devel(date=date)
103 except distro_info.DistroDataOutdated as e:
104+ import sys
105 sys.stderr.write(
106 "WARN: distro_info.UbuntuDistroInfo() raised exception (%s). "
107 "Using stable release as devel.\n" % e)

Subscribers

People subscribed via source and target branches