Merge ~ack/ubuntu/+source/maas:snap-default-version into ubuntu/+source/maas:ubuntu/devel

Proposed by Alberto Donato
Status: Rejected
Rejected by: Robie Basak
Proposed branch: ~ack/ubuntu/+source/maas:snap-default-version
Merge into: ubuntu/+source/maas:ubuntu/devel
Diff against target: 54 lines (+20/-1)
2 files modified
debian/changelog (+6/-0)
debian/maas.preinst (+14/-1)
Reviewer Review Type Date Requested Status
Julian Andres Klode (community) Disapprove
Review via email: mp+379801@code.launchpad.net

Commit message

set default snap track version to 2.7/stable if snapd doesn't support default tracks

To post a comment you must log in.
Revision history for this message
Adam Collard (adam-collard) :
04d5c4d... by Alberto Donato

rename function (Adam's review)

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

This seems to have been superseded by newer approaches, so disapproving.

review: Disapprove

Unmerged commits

04d5c4d... by Alberto Donato

rename function (Adam's review)

150a9d8... by Alberto Donato

set default snap track version to 2.7/stable if snapd doesn't support default tracks

e5187af... by Alberto Donato

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

Imported using git-ubuntu import.

Changelog parent: a029f174ab75946f2f82450abe170436983c7b8d

New changelog entries:
  * Fix dependencies to pre-depend on debconf and snapd
  * Fix project homepage URL to https

a029f17... by Alberto Donato

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

Imported using git-ubuntu import.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 47bb023..a8faaf2 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,9 @@
6+maas (1:0.3) focal; urgency=medium
7+
8+ * Set default snap version to 2.7 if default track support is not available in snapd
9+
10+ -- Alberto Donato <alberto.donato@canonical.com> Tue, 25 Feb 2020 12:05:15 +0100
11+
12 maas (1:0.2) focal; urgency=medium
13
14 * Fix dependencies to pre-depend on debconf and snapd
15diff --git a/debian/maas.preinst b/debian/maas.preinst
16index 15da5cd..7f40bdc 100755
17--- a/debian/maas.preinst
18+++ b/debian/maas.preinst
19@@ -1,6 +1,7 @@
20 #!/bin/bash -e
21
22 DEFAULT_UBUNTU_RELEASE="20.04"
23+DEFAULT_SNAP_VERSION="2.7"
24 DEFAULT_SNAP_TRACK="stable"
25
26 SNAP_COMMON="/var/snap/maas/common"
27@@ -14,6 +15,15 @@ get_snap_mode() {
28 cat "$SNAP_COMMON/snap_mode" 2>/dev/null || true
29 }
30
31+snapd_has_default_track_support() {
32+ local version
33+ version=$(snap version | awk '$1 == "snapd" { print $2; }')
34+ local major="${version%%.*}"
35+ local rest="${version#*.}"
36+ local minor="${rest%%.*}"
37+ [ "$major" -ge 2 ] && [ "$minor" -ge 44 ]
38+}
39+
40 check_connectivity() {
41 local count=0
42 while true; do
43@@ -60,7 +70,10 @@ install_snap() {
44 db_go
45 db_get maas/snap-track
46 local track="$RET"
47- [ -n "${track}" ] || track="$DEFAULT_SNAP_TRACK"
48+ if [ -z "$track" ]; then
49+ track="$DEFAULT_SNAP_TRACK"
50+ snapd_has_default_track_support || track="$DEFAULT_SNAP_VERSION/$track"
51+ fi
52
53 local release="$DEFAULT_UBUNTU_RELEASE"
54 if [ -e "/etc/os-release" ]; then

Subscribers

People subscribed via source and target branches