Merge lp:~oddbloke/livecd-rootfs/custom-model-assertions into lp:livecd-rootfs

Proposed by Dan Watkins
Status: Merged
Merged at revision: 1664
Proposed branch: lp:~oddbloke/livecd-rootfs/custom-model-assertions
Merge into: lp:livecd-rootfs
Diff against target: 87 lines (+38/-6) (has conflicts)
2 files modified
debian/changelog (+13/-0)
live-build/functions (+25/-6)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~oddbloke/livecd-rootfs/custom-model-assertions
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Robert C Jennings (community) Approve
Review via email: mp+343545@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dan Watkins (oddbloke) wrote :

I've tested building cloud images with this, and can confirm that this allows custom model assertions to be injected.

Revision history for this message
Steve Langasek (vorlon) :
review: Needs Fixing
1669. By Dan Watkins

Require brand:model to be passed to snap_prepare_assertions

We only need the default in one place, so remove it from all but the top-level
function.

1670. By Dan Watkins

Remove necessarily true conditional

Revision history for this message
Robert C Jennings (rcj) wrote :

+1

review: Approve
Revision history for this message
Dan Watkins (oddbloke) wrote :

Addressed Steve's comments and confirmed the new code works with another image build.

Revision history for this message
Steve Langasek (vorlon) wrote :

LGTM.

review: Approve
1671. By Dan Watkins

Add changelog entry

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2018-04-17 20:53:04 +0000
3+++ debian/changelog 2018-04-19 15:47:40 +0000
4@@ -1,3 +1,4 @@
5+<<<<<<< TREE
6 livecd-rootfs (2.522) bionic; urgency=medium
7
8 * Remove landscape-common from minimal image, and handle restoring it in
9@@ -5,6 +6,18 @@
10
11 -- Steve Langasek <steve.langasek@ubuntu.com> Tue, 17 Apr 2018 13:53:00 -0700
12
13+=======
14+livecd-rootfs (2.522) bionic; urgency=medium
15+
16+ * Allow the configuration of model assertions independent of preseeding
17+ snaps.
18+ * Allow non-generic model assertions to be configured.
19+ * Don't include the name of the model assertion in the path we write it out
20+ to (LP: #1764541).
21+
22+ -- Daniel Watkins <daniel.watkins@canonical.com> Thu, 19 Apr 2018 11:44:38 -0400
23+
24+>>>>>>> MERGE-SOURCE
25 livecd-rootfs (2.521) bionic; urgency=medium
26
27 * In subiquity image, mount additional squashfs in /media.
28
29=== modified file 'live-build/functions'
30--- live-build/functions 2018-04-10 21:33:22 +0000
31+++ live-build/functions 2018-04-19 15:47:40 +0000
32@@ -412,23 +412,29 @@
33 (cd $snaps_dir; ls -1 ${SNAP_NAME}_*.snap) >> $seed_yaml
34 }
35
36-snap_prepare() {
37- # Configure basic snapd assertions and pre-seeds the 'core' snap
38+snap_prepare_assertions() {
39+ # Configure basic snapd assertions
40 local CHROOT_ROOT=$1
41+ # A colon-separated string of brand:model to be used for the image's model
42+ # assertion
43+ local CUSTOM_BRAND_MODEL=$2
44
45 local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
46 local snaps_dir="$seed_dir/snaps"
47 local assertions_dir="$seed_dir/assertions"
48- local model_assertion="$assertions_dir/generic-classic.model"
49- local account_key_assertion="$assertions_dir/generic.account-key"
50- local account_assertion="$assertions_dir/generic.account"
51+ local model_assertion="$assertions_dir/model"
52+ local account_key_assertion="$assertions_dir/account-key"
53+ local account_assertion="$assertions_dir/account"
54
55 mkdir -p "$assertions_dir"
56 mkdir -p "$snaps_dir"
57
58+ local brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 1)"
59+ local model="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 2)"
60+
61 if ! [ -e "$model_assertion" ] ; then
62 snap known --remote model series=16 \
63- model=generic-classic brand-id=generic \
64+ model=$model brand-id=$brand \
65 > "$model_assertion"
66 fi
67
68@@ -446,6 +452,19 @@
69 snap known --remote account account-id=$account \
70 > "$account_assertion"
71 fi
72+}
73+
74+snap_prepare() {
75+ # Configure basic snapd assertions and pre-seeds the 'core' snap
76+ local CHROOT_ROOT=$1
77+ # Optional. If set, should be a colon-separated string of brand:model to be
78+ # used for the image's model assertion
79+ local CUSTOM_BRAND_MODEL=${2:-generic:generic-classic}
80+
81+ local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
82+ local snaps_dir="$seed_dir/snaps"
83+
84+ snap_prepare_assertions "$CHROOT_ROOT" "$CUSTOM_BRAND_MODEL"
85
86 # Download the core snap
87 if ! [ -f $snaps_dir/core_[0-9]*.snap ] ; then

Subscribers

People subscribed via source and target branches