Merge ~ack/ubuntu/+source/maas:snap-channel-2.7-default into ubuntu/+source/maas:ubuntu/focal-devel

Proposed by Alberto Donato
Status: Needs review
Proposed branch: ~ack/ubuntu/+source/maas:snap-channel-2.7-default
Merge into: ubuntu/+source/maas:ubuntu/focal-devel
Diff against target: 159 lines (+56/-29)
3 files modified
debian/changelog (+13/-0)
debian/maas.preinst (+42/-26)
debian/maas.templates (+1/-3)
Reviewer Review Type Date Requested Status
Julian Andres Klode (community) Approve
Review via email: mp+384013@code.launchpad.net

Commit message

Install snap from the 2.7/stable/ubuntu-$release channel by default.

- If currently installed maas is newer than 2.7, install from matching track.
- Rename maas/snap-track debconf var to maas/snap-channel (as the /ubuntu-$release is no longer appended)
- Fix wrong display of "MAAS not currently set up" message
- No-op when upgrading from a previous version of the transitional deb.

To post a comment you must log in.
Revision history for this message
Julian Andres Klode (juliank) wrote :

I'd avoid renaming the template, as that just causes churn in the database I suppose.

The version logic to not do the migration also triggers if you removed the maas snap (but not purged) and then reinstalled - is that correct?

Revision history for this message
Alberto Donato (ack) wrote :

> I'd avoid renaming the template, as that just causes churn in the database I
> suppose.

Is that a big deal?
I renamed it as the new name is more correct, and the old option has unlikely been ever used since we were always appending the "/ubuntu-$release" branch, which only existed for 20.04.
I can revert to the old name if it's an issue.

>
> The version logic to not do the migration also triggers if you removed the
> maas snap (but not purged) and then reinstalled - is that correct?

If you previously had installed a 1:* release, the migration would have been performed. Removing and reinstalling the deb shouldn't do anything in that case too.

e344f4f... by Alberto Donato

fix debian/maas-track template

Revision history for this message
Julian Andres Klode (juliank) wrote :

Oh, I thought you did that, but you also still need an SRU bug https://wiki.ubuntu.com/StableReleaseUpdates#SRU_Bug_Template and set the target release to focal in changelog.

review: Needs Fixing
9d21b6a... by Alberto Donato

fix changelog release

84aff9b... by Alberto Donato

fix changelog

Revision history for this message
Julian Andres Klode (juliank) :
review: Approve

Unmerged commits

84aff9b... by Alberto Donato

fix changelog

9d21b6a... by Alberto Donato

fix changelog release

e344f4f... by Alberto Donato

fix debian/maas-track template

bceb82a... by Alberto Donato

no-op if upgrading from a transitional deb

f214ec7... by Alberto Donato

fix not setup notice

54d09cc... by Alberto Donato

always point to the release branch if a channel is not specified

4580b3e... by Alberto Donato

point at 2.7 branch by default, unless installed maas is newer

8d80ee7... by Alberto Donato

Import patches-unapplied version 1:0.6 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: da0746bb20c11f985e4a2a2d0a96f87007976316

New changelog entries:
  * Fix snapd version check for default track support
  * Check if the snap is already installed, prompt the user in case it is

da0746b... by Alberto Donato

Import patches-unapplied version 1:0.5 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: 4b7509341f2cf5e617b5ef5ac1d09b52dd164f4e

New changelog entries:
  * Fix all lintian warning/errors

4b75093... by Alberto Donato

Import patches-unapplied version 1:0.4 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Upload parent: 14daa6d5fc4e98104718d3655ea489cf643f48f5

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index ca80f42..4809cde 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
1maas (1:0.7) focal; urgency=medium
2
3 * When a track is not specified, default to 2.7/stable. If MAAS deb
4 version is higher than 2.7, pick the same track. LP: #1878769
5 * Fix issue where "MAAS not currently set up" notice shows even when the
6 snap is configured.
7 * No-op when upgrading from a transitional deb, as migration already
8 happened.
9 * Rename "get_snap_mode" to "snap_mode".
10 * Rename DEFAULT_SNAP_* variables to align with snap terminology.
11
12 -- Alberto Donato <alberto.donato@canonical.com> Wed, 06 May 2020 13:48:50 +0200
13
1maas (1:0.6) focal; urgency=medium14maas (1:0.6) focal; urgency=medium
215
3 * Fix snapd version check for default track support16 * Fix snapd version check for default track support
diff --git a/debian/maas.preinst b/debian/maas.preinst
index 2279230..a1ae4ea 100755
--- a/debian/maas.preinst
+++ b/debian/maas.preinst
@@ -1,8 +1,7 @@
1#!/bin/bash -e1#!/bin/bash -e
22
3DEFAULT_UBUNTU_RELEASE="20.04"3DEFAULT_SNAP_TRACK="2.7"
4DEFAULT_SNAP_VERSION="2.7"4DEFAULT_SNAP_RISK="stable"
5DEFAULT_SNAP_TRACK="stable"
65
7SNAP_COMMON="/var/snap/maas/common"6SNAP_COMMON="/var/snap/maas/common"
87
@@ -12,6 +11,20 @@ error_exit() {
12 exit 111 exit 1
13}12}
1413
14os_release() {
15 # shellcheck disable=SC1091
16 (. /etc/os-release && echo "$VERSION_ID")
17}
18
19maas_version() {
20 # only return major.minor version
21 dpkg-query -W -f'${Version}\n' maas-common 2>/dev/null | cut -d. -f1,2
22}
23
24is_version() {
25 dpkg --compare-versions "$@"
26}
27
15is_deb_installed() {28is_deb_installed() {
16 dpkg-query -W -f'${Status}\n' "$1" 2>/dev/null | grep -q ^install29 dpkg-query -W -f'${Status}\n' "$1" 2>/dev/null | grep -q ^install
17}30}
@@ -20,19 +33,13 @@ is_snap_installed() {
20 snap list "$1" >/dev/null 2>&133 snap list "$1" >/dev/null 2>&1
21}34}
2235
23get_snap_mode() {36snap_mode() {
24 local snap_mode37 local mode
25 snap_mode=$(cat "$SNAP_COMMON/snap_mode" 2>/dev/null || true)38 mode=$(cat "$SNAP_COMMON/snap_mode" 2>/dev/null || true)
26 if [ -z "$snap_mode" ]; then39 if [ -z "$mode" ]; then
27 snap_mode="none"40 mode="none"
28 fi41 fi
29 echo "$snap_mode"42 echo "$mode"
30}
31
32snapd_has_default_track_support() {
33 local version
34 version=$(snap version | awk '$1 == "snapd" { print $2; }')
35 dpkg --compare-versions "$version" ">=" "2.44"
36}43}
3744
38ensure_snap_not_installed() {45ensure_snap_not_installed() {
@@ -94,18 +101,17 @@ install_snap() {
94 db_input medium maas/snap-track || true101 db_input medium maas/snap-track || true
95 db_go || true102 db_go || true
96 db_get maas/snap-track103 db_get maas/snap-track
97 local track="$RET"104 local channel="$RET"
98 if [ -z "$track" ]; then105 if [ -z "$channel" ]; then
99 track="$DEFAULT_SNAP_TRACK"106 local track
100 snapd_has_default_track_support || track="$DEFAULT_SNAP_VERSION/$track"107 track="$(maas_version)"
101 fi108 if [ -z "$track" ] || is_version "$track" "<<" "$DEFAULT_SNAP_TRACK"; then
102109 track="$DEFAULT_SNAP_TRACK"
103 local release="$DEFAULT_UBUNTU_RELEASE"110 fi
104 if [ -e "/etc/os-release" ]; then111 channel="$track/$DEFAULT_SNAP_RISK/ubuntu-$(os_release)"
105 release=$(. /etc/os-release && echo "$VERSION_ID")
106 fi112 fi
107113
108 snap install maas --channel="${track}/ubuntu-${release}"114 snap install maas --channel="$channel"
109}115}
110116
111migrate_to_snap() {117migrate_to_snap() {
@@ -121,7 +127,9 @@ preserve_db() {
121127
122notify_if_not_setup() {128notify_if_not_setup() {
123 # only show the notice if MAAS is not setup129 # only show the notice if MAAS is not setup
124 [ "$(get_snap_mode)" != "none" ] || return 0130 if [ "$(snap_mode)" != "none" ]; then
131 return 0
132 fi
125 db_input high maas/snap-needs-setup || true133 db_input high maas/snap-needs-setup || true
126 db_go || true134 db_go || true
127}135}
@@ -134,12 +142,20 @@ case "$1" in
134 ;;142 ;;
135 install|upgrade)143 install|upgrade)
136 # only perform tasks in these cases144 # only perform tasks in these cases
145 old_version="$2"
137 ;;146 ;;
138 *)147 *)
139 error_exit "preinst called with unknown argument: $1"148 error_exit "preinst called with unknown argument: $1"
140 ;;149 ;;
141esac150esac
142151
152if [[ "$old_version" = 1:* ]]; then
153 # upgrading from a transitional snap, nothing to do as migration already
154 # happened
155 exit 0
156fi
157
158# shellcheck disable=SC1091
143. /usr/share/debconf/confmodule159. /usr/share/debconf/confmodule
144160
145ensure_snap_not_installed161ensure_snap_not_installed
diff --git a/debian/maas.templates b/debian/maas.templates
index f81df06..b260d66 100644
--- a/debian/maas.templates
+++ b/debian/maas.templates
@@ -1,10 +1,8 @@
1Template: maas/snap-track1Template: maas/snap-track
2Type: string2Type: string
3_Description: Track for the MAAS snap:3_Description: Channel for the MAAS snap:
4 This can be specified just as a track name (e.g. "2.7", "latest", ...) or include4 This can be specified just as a track name (e.g. "2.7", "latest", ...) or include
5 a risk as well (e.g. "latest/candidate").5 a risk as well (e.g. "latest/candidate").
6 .
7 If not specified "stable" will be used.
86
9Template: maas/snap-no-connectivity7Template: maas/snap-no-connectivity
10Type: select8Type: select

Subscribers

People subscribed via source and target branches