Merge lp:~jason-hobbs/maas/curtin-use-drivers into lp:~maas-committers/maas/trunk

Proposed by Jason Hobbs
Status: Merged
Approved by: Jason Hobbs
Approved revision: no longer in the source branch.
Merged at revision: 2270
Proposed branch: lp:~jason-hobbs/maas/curtin-use-drivers
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 30 lines (+18/-0)
1 file modified
contrib/preseeds_v2/curtin_userdata (+18/-0)
To merge this branch: bzr merge lp:~jason-hobbs/maas/curtin-use-drivers
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+215873@code.launchpad.net

Commit message

Make curtin use third party drivers.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

a.) please use '--quiet' on apt-get update. and I prefer '--assume-yes' to '-y' as it is self-documenting.
b.) i think if you need to 'update-initramfs' then something is wrong the package installation should trigger the initramfs re-build.
c.) the '[]' version of values is preferred I think. It is more explicit. You're passing all that to /bin/sh, which gets you a level of shell interpretation that you may or may not want (and can cause issues).

ie:
- driver_04_update_install: curtin in-target -- apt-get update
+ driver_04_update_install: ["curtin", "in-target", "--", "apt-get", "update"]

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

Lgtm! I'll approve but run it trhough scott too for him to approve.

review: Approve
Revision history for this message
Scott Moser (smoser) wrote :

looks fine other than
  s/-y/--assume-yes/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'contrib/preseeds_v2/curtin_userdata'
2--- contrib/preseeds_v2/curtin_userdata 2014-01-29 15:42:47 +0000
3+++ contrib/preseeds_v2/curtin_userdata 2014-04-15 14:56:26 +0000
4@@ -4,8 +4,26 @@
5 {{for line in str(curtin_preseed).splitlines()}}
6 {{line}}
7 {{endfor}}
8+{{if third_party_drivers and driver}}
9+early_commands:
10+ {{py: key_string = ''.join(['\\x%x' % x for x in map(ord, driver['key_binary'])])}}
11+ driver_00_get_key: /bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg
12+ driver_01_add_key: ["apt-key", "add", "/tmp/maas-{{driver['package']}}.gpg"]
13+ driver_02_add: ["add-apt-repository", "-y", "deb {{driver['repository']}} {{node.get_distro_series()}} main"]
14+ driver_03_update_install: ["sh", "-c", "apt-get update --quiet && apt-get --assume-yes install {{driver['package']}}"]
15+ driver_04_load: ["sh", "-c", "depmod && modprobe {{driver['module']}}"]
16+{{endif}}
17 late_commands:
18 maas: [wget, '--no-proxy', '{{node_disable_pxe_url|escape.shell}}', '--post-data', '{{node_disable_pxe_data|escape.shell}}', '-O', '/dev/null']
19+{{if third_party_drivers and driver}}
20+ driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg"
21+ driver_02_key_add: ["curtin", "in-target", "--", "apt-key", "add", "/tmp/maas-{{driver['package']}}.gpg"]
22+ driver_03_add: ["curtin", "in-target", "--", "add-apt-repository", "-y", "deb {{driver['repository']}} {{node.get_distro_series()}} main"]
23+ driver_04_update_install: ["curtin", "in-target", "--", "apt-get", "update", "--quiet"]
24+ driver_05_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{driver['package']}}"]
25+ driver_06_depmod: ["curtin", "in-target", "--", "depmod"]
26+ driver_07_update_initramfs: ["curtin", "in-target", "--", "update-initramfs", "-u"]
27+{{endif}}
28
29 power_state:
30 mode: reboot