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
=== modified file 'debian/changelog'
--- debian/changelog 2018-04-17 20:53:04 +0000
+++ debian/changelog 2018-04-19 15:47:40 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1livecd-rootfs (2.522) bionic; urgency=medium2livecd-rootfs (2.522) bionic; urgency=medium
23
3 * Remove landscape-common from minimal image, and handle restoring it in4 * Remove landscape-common from minimal image, and handle restoring it in
@@ -5,6 +6,18 @@
56
6 -- Steve Langasek <steve.langasek@ubuntu.com> Tue, 17 Apr 2018 13:53:00 -07007 -- Steve Langasek <steve.langasek@ubuntu.com> Tue, 17 Apr 2018 13:53:00 -0700
78
9=======
10livecd-rootfs (2.522) bionic; urgency=medium
11
12 * Allow the configuration of model assertions independent of preseeding
13 snaps.
14 * Allow non-generic model assertions to be configured.
15 * Don't include the name of the model assertion in the path we write it out
16 to (LP: #1764541).
17
18 -- Daniel Watkins <daniel.watkins@canonical.com> Thu, 19 Apr 2018 11:44:38 -0400
19
20>>>>>>> MERGE-SOURCE
8livecd-rootfs (2.521) bionic; urgency=medium21livecd-rootfs (2.521) bionic; urgency=medium
922
10 * In subiquity image, mount additional squashfs in /media.23 * In subiquity image, mount additional squashfs in /media.
1124
=== modified file 'live-build/functions'
--- live-build/functions 2018-04-10 21:33:22 +0000
+++ live-build/functions 2018-04-19 15:47:40 +0000
@@ -412,23 +412,29 @@
412 (cd $snaps_dir; ls -1 ${SNAP_NAME}_*.snap) >> $seed_yaml412 (cd $snaps_dir; ls -1 ${SNAP_NAME}_*.snap) >> $seed_yaml
413}413}
414414
415snap_prepare() {415snap_prepare_assertions() {
416 # Configure basic snapd assertions and pre-seeds the 'core' snap416 # Configure basic snapd assertions
417 local CHROOT_ROOT=$1417 local CHROOT_ROOT=$1
418 # A colon-separated string of brand:model to be used for the image's model
419 # assertion
420 local CUSTOM_BRAND_MODEL=$2
418421
419 local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"422 local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
420 local snaps_dir="$seed_dir/snaps"423 local snaps_dir="$seed_dir/snaps"
421 local assertions_dir="$seed_dir/assertions"424 local assertions_dir="$seed_dir/assertions"
422 local model_assertion="$assertions_dir/generic-classic.model"425 local model_assertion="$assertions_dir/model"
423 local account_key_assertion="$assertions_dir/generic.account-key"426 local account_key_assertion="$assertions_dir/account-key"
424 local account_assertion="$assertions_dir/generic.account"427 local account_assertion="$assertions_dir/account"
425428
426 mkdir -p "$assertions_dir"429 mkdir -p "$assertions_dir"
427 mkdir -p "$snaps_dir"430 mkdir -p "$snaps_dir"
428431
432 local brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 1)"
433 local model="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 2)"
434
429 if ! [ -e "$model_assertion" ] ; then435 if ! [ -e "$model_assertion" ] ; then
430 snap known --remote model series=16 \436 snap known --remote model series=16 \
431 model=generic-classic brand-id=generic \437 model=$model brand-id=$brand \
432 > "$model_assertion"438 > "$model_assertion"
433 fi439 fi
434440
@@ -446,6 +452,19 @@
446 snap known --remote account account-id=$account \452 snap known --remote account account-id=$account \
447 > "$account_assertion"453 > "$account_assertion"
448 fi454 fi
455}
456
457snap_prepare() {
458 # Configure basic snapd assertions and pre-seeds the 'core' snap
459 local CHROOT_ROOT=$1
460 # Optional. If set, should be a colon-separated string of brand:model to be
461 # used for the image's model assertion
462 local CUSTOM_BRAND_MODEL=${2:-generic:generic-classic}
463
464 local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
465 local snaps_dir="$seed_dir/snaps"
466
467 snap_prepare_assertions "$CHROOT_ROOT" "$CUSTOM_BRAND_MODEL"
449468
450 # Download the core snap469 # Download the core snap
451 if ! [ -f $snaps_dir/core_[0-9]*.snap ] ; then470 if ! [ -f $snaps_dir/core_[0-9]*.snap ] ; then

Subscribers

People subscribed via source and target branches