Merge ~chad.smith/ubuntu/+source/ubuntu-advantage-tools:release-27-groovy into ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel

Proposed by Chad Smith
Status: Merged
Approved by: Bryce Harrington
Approved revision: ef1f90890747ebc4a74f707d72395c3d5bfa23d8
Merge reported by: Chad Smith
Merged at revision: a186c591bcab0b8758307d850718e604de61b7d7
Proposed branch: ~chad.smith/ubuntu/+source/ubuntu-advantage-tools:release-27-groovy
Merge into: ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel
Diff against target: 398 lines (+200/-5) (has conflicts)
10 files modified
.gitignore (+8/-0)
Jenkinsfile (+16/-0)
apt-hook/Makefile (+30/-0)
apt-hook/json-hook-src/go.mod (+4/-0)
apt-hook/json-hook-src/json-hook.go (+42/-0)
apt-hook/json-hook-src/json-hook_test.go (+34/-0)
debian/changelog (+20/-0)
debian/control (+7/-0)
debian/rules (+1/-0)
uaclient/tests/test_util.py (+38/-5)
Conflict in .gitignore
Conflict in Jenkinsfile
Conflict in apt-hook/Makefile
Conflict in apt-hook/json-hook-src/go.mod
Conflict in apt-hook/json-hook-src/json-hook.go
Conflict in apt-hook/json-hook-src/json-hook_test.go
Conflict in debian/changelog
Conflict in debian/control
Conflict in uaclient/tests/test_util.py
Reviewer Review Type Date Requested Status
Bryce Harrington Approve
Review via email: mp+401983@code.launchpad.net

Description of the change

New upstream release of 27.0 for release into groovy

Avoiding rich commit history because this is a branch new client (python instead of bash) which represented a major upgrade that is backwards incompatible.

We will be following this verification procedure for SRU of ubuntu-advantage-tools in order to release into groovy: https://wiki.ubuntu.com/UbuntuAdvantageToolsUpdates

Note that groovy doesn't have esm-infra, esm-apps or FIPS product offerings so this client will not allow enabling any UA services:

Expect messages like:

root@test-g:~# ua enable esm-apps
One moment, checking your subscription first
ESM Apps is not available for Ubuntu 20.10 (Groovy Gorilla)

Functional equivalent debs have been uploaded to this ppa for testing https://launchpad.net/~orndorffgrant/+archive/ubuntu/uaclient-staging-27

to test:
$ cat > 27_test_setup.yaml <<EOF
#cloud-config
write_files:
- content: |
    # Ubuntu-Advantage client config file.
    contract_url: 'https://contracts.canonical.com'
    data_dir: /var/lib/ubuntu-advantage
    log_level: debug
    log_file: /var/log/ubuntu-advantage.log
    features:
        allow_beta: true
  owner: root:root
  path: /etc/ubuntu-advantage/uaclient.conf
  permissions: '0644'
apt:
  sources:
    ua_staging_ppa:
        source: 'deb http://ppa.launchpad.net/orndorffgrant/uaclient-staging-27/ubuntu \$RELEASE main'
        keyid: 74E59E9E
packages: [ubuntu-advantage-tools]
EOF

$ lxc launch ubuntu-daily:xenial test-27-x -c user.user-data="$(cat 27_test_setup.yaml)"
$ lxc exec test-27-x -- cloud-init status --wait --long # wait for pkg installs

$ lxc exec test-27-x -- ua version

$ lxc exec test-27-x -- ua status # show unattached

This machine is not attached to a UA subscription.
See https://ubuntu.com/advantage

# attach with token from https://ubuntu.com/advantage
$ lxc exec test-27-x -- ua attach <REDACTED>
# assert esm-infra auto enabled

# no failures on attach
root@test-27-h:~# grep Traceback /var/log/ubuntu-advantage.log

# assert default contract not authorized to esm-apps
$ lxc exec test-27-x -- ua enable esm-apps

will manipulate other subcommands

To post a comment you must log in.
1ff489a... by Grant Orndorff on 2021-04-28

apt-hook: mitigate failures with true

In case something catastrophic happens
in our apt hooks, we now make sure the subprocess
always returns successfully by calling `true`
if our hook fails.

Revision history for this message
Bryce Harrington (bryce) wrote :

While it's unlikely groovy will be an upgrade path for ESM users, it's good to include this for completeness given it's still theoretically possible. My review has been super light, mainly just verifying the same changes are included as in the other branches.

Tagged and uploaded:

triage-groovy+20.10:~/pkg/UbuntuAdvantageTools/review-mp401983$ dput ubuntu ubuntu-advantage-tools_27.0~20.10.1_source.changes
Checking signature on .changes
gpg: /home/bryce/pkg/UbuntuAdvantageTools/review-mp401983/ubuntu-advantage-tools_27.0~20.10.1_source.changes: Valid signature from E603B2578FB8F0FB
Checking signature on .dsc
gpg: /home/bryce/pkg/UbuntuAdvantageTools/review-mp401983/ubuntu-advantage-tools_27.0~20.10.1.dsc: Valid signature from E603B2578FB8F0FB
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading ubuntu-advantage-tools_27.0~20.10.1.dsc: done.
  Uploading ubuntu-advantage-tools_27.0~20.10.1.tar.xz: done.
  Uploading ubuntu-advantage-tools_27.0~20.10.1_source.buildinfo: done.
  Uploading ubuntu-advantage-tools_27.0~20.10.1_source.changes: done.
Successfully uploaded packages.
triage-groovy+20.10:~/pkg/UbuntuAdvantageTools/review-mp401983$ cd ubuntu-advantage-tools-gu/
triage-groovy+20.10:~/pkg/UbuntuAdvantageTools/review-mp401983/ubuntu-advantage-tools-gu$ git ubuntu tag --upload
triage-groovy+20.10:~/pkg/UbuntuAdvantageTools/review-mp401983/ubuntu-advantage-tools-gu$ git push -f pkg upload/27.0_20.10.1

Enumerating objects: 250, done.
Counting objects: 100% (250/250), done.
Delta compression using up to 12 threads
Compressing objects: 100% (118/118), done.
Writing objects: 100% (163/163), 212.83 KiB | 443.00 KiB/s, done.
Total 163 (delta 67), reused 117 (delta 42), pack-reused 0
remote: Resolving deltas: 100% (67/67), completed with 53 local objects.
To ssh://git.launchpad.net/ubuntu/+source/ubuntu-advantage-tools
 * [new tag] upload/27.0_20.10.1 -> upload/27.0_20.10.1

review: Approve
b32b476... by Grant Orndorff on 2021-04-30

apt-hook: refactor json hook messaging to be dry

The message construction code in the json hook
was pretty repetitive. This cleans it up a bit
and also removes some unnecessary explicit struct
names in the tests.

4053b40... by Grant Orndorff on 2021-05-03

apt-hook: ignore go hook on some architectures

Golang doesn't support powerpc and riscv on older versions.
This configures our Build-Depends and Makefile to gracefully
handle scenarios where we can't build our go hook. We will
simply not ship the go hook in these limited scenarios.

Fixes: #1603

d32eef4... by Grant Orndorff on 2021-05-04

build: order build-depends alternatives newer first

When using alternatives in the Build-Depends section of
debian/control, we should always put the newer version of
a package first. This is because sbuild doesn't resolve
alternatives by default and we want sbuild to work on the
latest version of ubuntu with default settings.

LP: #1926949

f30579b... by Grant Orndorff on 2021-05-06

tests: fix subp ls error case

3bfe06c... by Chad Smith on 2021-05-07

changelog 27.0.1 & 27.0.2

4da4d2b... by Chad Smith on 2021-05-07

jenkinsfile: trusty sbuild --resolve-depends for CI runs

a186c59... by Chad Smith on 2021-05-07

changelog: 27.0.2~20.10.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 2b2da67..29b86f4 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -22,3 +22,11 @@ ubuntu_advantage_tools.dsc
6 # test/jenkins artifacts
7 pytest_results.xml
8 reports/
9+<<<<<<< .gitignore
10+=======
11+
12+# apt-hook build artifacts
13+apt-hook/hook
14+apt-hook/ubuntu-advantage.pot
15+apt-hook/json-hook-src/json-hook
16+>>>>>>> .gitignore
17diff --git a/Jenkinsfile b/Jenkinsfile
18index 2082e19..925a9c3 100644
19--- a/Jenkinsfile
20+++ b/Jenkinsfile
21@@ -87,7 +87,11 @@ pipeline {
22 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
23 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
24 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
25+<<<<<<< Jenkinsfile
26 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
27+=======
28+ sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
29+>>>>>>> Jenkinsfile
30 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
31 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
32 '''
33@@ -108,7 +112,11 @@ pipeline {
34 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
35 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
36 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
37+<<<<<<< Jenkinsfile
38 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
39+=======
40+ sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
41+>>>>>>> Jenkinsfile
42 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
43 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
44 '''
45@@ -129,7 +137,11 @@ pipeline {
46 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
47 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
48 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
49+<<<<<<< Jenkinsfile
50 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
51+=======
52+ sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
53+>>>>>>> Jenkinsfile
54 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
55 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
56 '''
57@@ -150,7 +162,11 @@ pipeline {
58 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
59 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
60 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
61+<<<<<<< Jenkinsfile
62 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
63+=======
64+ sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
65+>>>>>>> Jenkinsfile
66 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
67 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
68 '''
69diff --git a/apt-hook/Makefile b/apt-hook/Makefile
70index 15c4856..11294b1 100644
71--- a/apt-hook/Makefile
72+++ b/apt-hook/Makefile
73@@ -1,3 +1,21 @@
74+# the go hook steps will be skipped if this is a nonempty string
75+SKIP_GO_HOOK = ""
76+
77+GO_BIN = $(shell which go)
78+# Try go-1.14 and go-1.10 if not in path
79+ifeq ($(GO_BIN),)
80+ ifneq ($(wildcard /usr/lib/go-1.14/bin/go),)
81+ GO_BIN = /usr/lib/go-1.14/bin/go
82+ else ifneq ($(wildcard /usr/lib/go-1.10/bin/go),)
83+ GO_BIN = /usr/lib/go-1.10/bin/go
84+ endif
85+endif
86+
87+# If still not found then just don't build the go hook
88+ifeq ($(GO_BIN),)
89+ SKIP_GO_HOOK = "1"
90+endif
91+
92 all: build
93
94 build: hook ubuntu-advantage.pot json-hook
95@@ -9,15 +27,27 @@ hook: hook.cc
96 $(CXX) -Wall -Wextra -pedantic -std=c++11 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -g -o hook hook.cc -lapt-pkg $(LDLIBS)
97
98 json-hook:
99+<<<<<<< apt-hook/Makefile
100 cd json-hook-src && GOCACHE=/tmp/ go build json-hook.go
101+=======
102+ [ $(SKIP_GO_HOOK) ] || (cd json-hook-src && GOCACHE=/tmp/ $(GO_BIN) build json-hook.go)
103+>>>>>>> apt-hook/Makefile
104
105 install: hook json-hook
106 install -D -m 644 20apt-esm-hook.conf $(DESTDIR)/etc/apt/apt.conf.d/20apt-esm-hook.conf
107 install -D -m 755 hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-hook
108+<<<<<<< apt-hook/Makefile
109 install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook
110+=======
111+ [ $(SKIP_GO_HOOK) ] || install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook
112+>>>>>>> apt-hook/Makefile
113
114 clean:
115 rm -f hook ubuntu-advantage.pot json-hook-src/json-hook
116
117 test:
118+<<<<<<< apt-hook/Makefile
119 cd json-hook-src && go test
120+=======
121+ [ $(SKIP_GO_HOOK) ] || (cd json-hook-src && GOCACHE=/tmp/ $(GO_BIN) test)
122+>>>>>>> apt-hook/Makefile
123diff --git a/apt-hook/json-hook-src/go.mod b/apt-hook/json-hook-src/go.mod
124index 66726af..2823e25 100644
125--- a/apt-hook/json-hook-src/go.mod
126+++ b/apt-hook/json-hook-src/go.mod
127@@ -1,3 +1,7 @@
128 module json-hook
129
130+<<<<<<< apt-hook/json-hook-src/go.mod
131 go 1.2
132+=======
133+go 1.7
134+>>>>>>> apt-hook/json-hook-src/go.mod
135diff --git a/apt-hook/json-hook-src/json-hook.go b/apt-hook/json-hook-src/json-hook.go
136index 0f2e3eb..fc6b704 100644
137--- a/apt-hook/json-hook-src/json-hook.go
138+++ b/apt-hook/json-hook-src/json-hook.go
139@@ -45,6 +45,21 @@ type jsonRPC struct {
140 } `json:"params"`
141 }
142
143+<<<<<<< apt-hook/json-hook-src/json-hook.go
144+=======
145+func updatesFromSource(count int, source string, first bool) string {
146+ security := ""
147+ if first {
148+ security = "security "
149+ }
150+ updates := "updates"
151+ if count == 1 {
152+ updates = "update"
153+ }
154+ return fmt.Sprintf("%d %s %s%s", count, source, security, updates)
155+}
156+
157+>>>>>>> apt-hook/json-hook-src/json-hook.go
158 func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCount int) string {
159 displayStandard := true
160 displayEsmInfra := true
161@@ -72,6 +87,7 @@ func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCo
162 }
163
164 standardUpdates := ""
165+<<<<<<< apt-hook/json-hook-src/json-hook.go
166 esmInfraUpdates := ""
167 esmAppsUpdates := ""
168 if displayStandard {
169@@ -118,6 +134,32 @@ func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCo
170 }
171
172 return standardUpdates + esmInfraUpdates + esmAppsUpdates
173+=======
174+ afterStandard := ""
175+ esmInfraUpdates := ""
176+ afterInfra := ""
177+ esmAppsUpdates := ""
178+
179+ if displayStandard {
180+ standardUpdates = updatesFromSource(standardSecurityCount, "standard", true)
181+ if displayEsmInfra && displayEsmApps {
182+ afterStandard = ", "
183+ } else if displayEsmInfra || displayEsmApps {
184+ afterStandard = " and "
185+ }
186+ }
187+ if displayEsmInfra {
188+ esmInfraUpdates = updatesFromSource(esmInfraCount, "esm-infra", esmInfraFirst)
189+ if displayEsmApps {
190+ afterInfra = " and "
191+ }
192+ }
193+ if displayEsmApps {
194+ esmAppsUpdates = updatesFromSource(esmAppsCount, "esm-apps", esmAppsFirst)
195+ }
196+
197+ return standardUpdates + afterStandard + esmInfraUpdates + afterInfra + esmAppsUpdates
198+>>>>>>> apt-hook/json-hook-src/json-hook.go
199 }
200
201 func fromOriginAndArchive(pkgVersion jsonRPCPackageVersion, origin string, archive string) bool {
202diff --git a/apt-hook/json-hook-src/json-hook_test.go b/apt-hook/json-hook-src/json-hook_test.go
203index cfc1788..135ec2c 100644
204--- a/apt-hook/json-hook-src/json-hook_test.go
205+++ b/apt-hook/json-hook-src/json-hook_test.go
206@@ -14,6 +14,7 @@ func TestCreateUpdateMessages(t *testing.T) {
207 expectedMessage string
208 }
209 testParamsList := []params{
210+<<<<<<< apt-hook/json-hook-src/json-hook_test.go
211 params{0, 0, 0, ""},
212 params{0, 0, 1, "1 esm-apps security update"},
213 params{0, 0, 2, "2 esm-apps security updates"},
214@@ -41,6 +42,35 @@ func TestCreateUpdateMessages(t *testing.T) {
215 params{2, 2, 0, "2 standard security updates and 2 esm-infra updates"},
216 params{2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"},
217 params{2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"},
218+=======
219+ {0, 0, 0, ""},
220+ {0, 0, 1, "1 esm-apps security update"},
221+ {0, 0, 2, "2 esm-apps security updates"},
222+ {0, 1, 0, "1 esm-infra security update"},
223+ {0, 1, 1, "1 esm-infra security update and 1 esm-apps update"},
224+ {0, 1, 2, "1 esm-infra security update and 2 esm-apps updates"},
225+ {0, 2, 0, "2 esm-infra security updates"},
226+ {0, 2, 1, "2 esm-infra security updates and 1 esm-apps update"},
227+ {0, 2, 2, "2 esm-infra security updates and 2 esm-apps updates"},
228+ {1, 0, 0, "1 standard security update"},
229+ {1, 0, 1, "1 standard security update and 1 esm-apps update"},
230+ {1, 0, 2, "1 standard security update and 2 esm-apps updates"},
231+ {1, 1, 0, "1 standard security update and 1 esm-infra update"},
232+ {1, 1, 1, "1 standard security update, 1 esm-infra update and 1 esm-apps update"},
233+ {1, 1, 2, "1 standard security update, 1 esm-infra update and 2 esm-apps updates"},
234+ {1, 2, 0, "1 standard security update and 2 esm-infra updates"},
235+ {1, 2, 1, "1 standard security update, 2 esm-infra updates and 1 esm-apps update"},
236+ {1, 2, 2, "1 standard security update, 2 esm-infra updates and 2 esm-apps updates"},
237+ {2, 0, 0, "2 standard security updates"},
238+ {2, 0, 1, "2 standard security updates and 1 esm-apps update"},
239+ {2, 0, 2, "2 standard security updates and 2 esm-apps updates"},
240+ {2, 1, 0, "2 standard security updates and 1 esm-infra update"},
241+ {2, 1, 1, "2 standard security updates, 1 esm-infra update and 1 esm-apps update"},
242+ {2, 1, 2, "2 standard security updates, 1 esm-infra update and 2 esm-apps updates"},
243+ {2, 2, 0, "2 standard security updates and 2 esm-infra updates"},
244+ {2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"},
245+ {2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"},
246+>>>>>>> apt-hook/json-hook-src/json-hook_test.go
247 }
248
249 for i, testParams := range testParamsList {
250@@ -62,7 +92,11 @@ func TestCountSecurityUpdates(t *testing.T) {
251 expectedEsmAppsCount int
252 }
253 testParamsList := []params{
254+<<<<<<< apt-hook/json-hook-src/json-hook_test.go
255 params{mockJson, 1, 2, 3},
256+=======
257+ {mockJson, 1, 2, 3},
258+>>>>>>> apt-hook/json-hook-src/json-hook_test.go
259 }
260
261 for i, testParams := range testParamsList {
262diff --git a/debian/changelog b/debian/changelog
263index 9c6e17f..9e60d7f 100644
264--- a/debian/changelog
265+++ b/debian/changelog
266@@ -1,3 +1,19 @@
267+<<<<<<< debian/changelog
268+=======
269+ubuntu-advantage-tools (27.0.2~20.10.1) groovy; urgency=medium
270+
271+ * d/control:
272+ - order build-depends alternatives newer first (LP: #1926949)
273+ - apt-hook: do not attempt to package go APT JSON hook on some
274+ architectures (GH: #1603) (LP: #1927795)
275+ * Bug-fix release 27.0.2: build failures on riscv64 and powerpc
276+ - apt-hook: refactor json hook messaging to be dry
277+ - tests: fix subp ls error case for powerpc builds
278+ - jenkinsfile: add --resolve-alternatives for trusty builds
279+
280+ -- Chad Smith <chad.smith@canonical.com> Fri, 07 May 2021 11:58:03 -0600
281+
282+>>>>>>> debian/changelog
283 ubuntu-advantage-tools (27.0.1) impish; urgency=medium
284
285 * Add .gitignore and cleanup ignored directory .pytest_cache
286@@ -8,6 +24,10 @@ ubuntu-advantage-tools (27.0.1) impish; urgency=medium
287 ubuntu-advantage-tools (27.0) impish; urgency=medium
288
289 * New upstream release 27.0:
290+<<<<<<< debian/changelog
291+=======
292+ - apt-hook: mitigate failures with true
293+>>>>>>> debian/changelog
294 - messages: add optional (s) to apt messaging to include
295 singular/plural pkgs
296 - apt-hook: avoid reporting and counting duplicate package
297diff --git a/debian/control b/debian/control
298index cd28a1f..660a80d 100644
299--- a/debian/control
300+++ b/debian/control
301@@ -6,10 +6,17 @@ Build-Depends: bash-completion,
302 debhelper (>=9),
303 debianutils,
304 dh-python,
305+<<<<<<< debian/control
306 dh-systemd | debhelper (>= 13.3),
307 gettext,
308 git,
309 golang,
310+=======
311+ debhelper (>= 13.3) | dh-systemd,
312+ gettext,
313+ git,
314+ golang-go (>= 2:1.14~) [!powerpc] | golang-1.14-go [!powerpc] | golang-1.10-go [!powerpc !riscv64],
315+>>>>>>> debian/control
316 libapt-pkg-dev,
317 po-debconf,
318 python3 (>= 3.4),
319diff --git a/debian/rules b/debian/rules
320index 9bea522..57898f9 100755
321--- a/debian/rules
322+++ b/debian/rules
323@@ -27,6 +27,7 @@ override_dh_auto_build:
324
325 override_dh_auto_test:
326 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
327+ make -C apt-hook test
328 python3 -m pytest
329 ifdef FLAKE8
330 # required for Trusty: flake8 does not install a __main__ for -m
331diff --git a/uaclient/tests/test_util.py b/uaclient/tests/test_util.py
332index 019faf2..29a5bd2 100644
333--- a/uaclient/tests/test_util.py
334+++ b/uaclient/tests/test_util.py
335@@ -291,11 +291,12 @@ class TestSubp:
336 with pytest.raises(util.ProcessExecutionError) as excinfo:
337 util.subp(["ls", "--bogus"])
338
339- expected_error = (
340- "Failed running command 'ls --bogus' [exit(2)]."
341- " Message: ls: unrecognized option"
342- )
343- assert expected_error in str(excinfo.value)
344+ expected_errors = [
345+ "Failed running command 'ls --bogus' [exit(2)].",
346+ "ls: unrecognized option '--bogus'",
347+ ]
348+ for msg in expected_errors:
349+ assert msg in str(excinfo.value)
350 assert 0 == m_sleep.call_count # no retries
351
352 @mock.patch("uaclient.util.time.sleep")
353@@ -795,6 +796,37 @@ class TestIsConfigValueTrue:
354 config=cfg.cfg, path_to_value="features.allow_beta"
355 )
356 assert return_val == actual_val
357+<<<<<<< uaclient/tests/test_util.py
358+
359+ @pytest.mark.parametrize(
360+ "config_dict, key_val",
361+ [
362+ ({"allow_beta": "tru"}, "tru"),
363+ ({"allow_beta": "Tre"}, "Tre"),
364+ ({"allow_beta": "flse"}, "flse"),
365+ ({"allow_beta": "Fale"}, "Fale"),
366+ ],
367+ )
368+ def test_exception_is_config_value_true(
369+ self, config_dict, key_val, FakeConfig
370+ ):
371+ path_to_value = "features.allow_beta"
372+ cfg = FakeConfig()
373+ cfg.override_features(config_dict)
374+ with pytest.raises(exceptions.UserFacingError) as excinfo:
375+ util.is_config_value_true(
376+ config=cfg.cfg, path_to_value=path_to_value
377+ )
378+
379+ expected_msg = status.ERROR_INVALID_CONFIG_VALUE.format(
380+ path_to_value=path_to_value,
381+ expected_value="boolean string: true or false",
382+ value=key_val,
383+ )
384+ assert expected_msg == str(excinfo.value)
385+
386+
387+=======
388
389 @pytest.mark.parametrize(
390 "config_dict, key_val",
391@@ -824,6 +856,7 @@ class TestIsConfigValueTrue:
392 assert expected_msg == str(excinfo.value)
393
394
395+>>>>>>> uaclient/tests/test_util.py
396 class TestRedactSensitiveLogs:
397 @pytest.mark.parametrize(
398 "raw_log,expected",

Subscribers

People subscribed via source and target branches

to status/vote changes: