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

Proposed by Chad Smith
Status: Merged
Approved by: Bryce Harrington
Approved revision: 153a74cbb2d70e56355b9f0e07f62e07267534f4
Merge reported by: Chad Smith
Merged at revision: 6880d56c4bf257c8b82bc9a031e5cc9b08df304c
Proposed branch: ~chad.smith/ubuntu/+source/ubuntu-advantage-tools:release-27-bionic
Merge into: ubuntu/+source/ubuntu-advantage-tools:ubuntu/bionic-proposed
Diff against target: 356 lines (+179/-0) (has conflicts)
10 files modified
.gitignore (+8/-0)
Jenkinsfile (+16/-0)
apt-hook/Makefile (+33/-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 (+22/-0)
debian/control (+7/-0)
debian/rules (+4/-0)
uaclient/tests/test_util.py (+9/-0)
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 debian/rules
Conflict in uaclient/tests/test_util.py
Reviewer Review Type Date Requested Status
Bryce Harrington (community) Approve
Grant Orndorff Pending
Lucas Albuquerque Medeiros de Moura Pending
Review via email: mp+401916@code.launchpad.net

Description of the change

New upstream release of 27.0 for release into xenial

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 xenial: https://wiki.ubuntu.com/UbuntuAdvantageToolsUpdates

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:biojnic test-27-b -c user.user-data="$(cat 27_test_setup.yaml)"
$ lxc exec test-27-b -- cloud-init status --wait --long # wait for pkg installs

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

$ lxc exec test-27-b -- 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-b -- ua attach <REDACTED>
# assert esm-infra auto enabled

# no failures on attach
lxc exect test-27-b -- grep Traceback /var/log/ubuntu-advantage.log

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

will manipulate other subcommands

To post a comment you must log in.
Revision history for this message
Chad Smith (chad.smith) wrote :
Download full text (5.0 KiB)

csmith@downtown:/tmp$ lxc exec test-27-b -- cloud-init status --wait --long

status: done
time: Wed, 28 Apr 2021 00:09:04 +0000
detail:
DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]
csmith@downtown:/tmp$ lxc exec test-27-b -- ua version
27.0~18.04.1 +allow_beta +extra_security_params
csmith@downtown:/tmp$ lxc exec test-27-b -- ua status
SERVICE AVAILABLE DESCRIPTION
cc-eal no Common Criteria EAL2 Provisioning Packages
cis yes Center for Internet Security Audit Tools
esm-apps yes UA Apps: Extended Security Maintenance (ESM)
esm-infra yes UA Infra: Extended Security Maintenance (ESM)
fips yes NIST-certified FIPS modules
fips-updates yes Uncertified security updates to FIPS modules
livepatch yes Canonical Livepatch service

This machine is not attached to a UA subscription.
See https://ubuntu.com/advantage
csmith@downtown:/tmp$ lxc exec test-27-b -- ua attach <REDACTED_NO_APPS_>
Enabling default service esm-infra
Updating package lists
UA Infra: ESM enabled
This machine is now attached to '<email address hidden>'

SERVICE ENTITLED STATUS DESCRIPTION
cc-eal yes n/a Common Criteria EAL2 Provisioning Packages
cis yes disabled Center for Internet Security Audit Tools
esm-apps no — UA Apps: Extended Security Maintenance (ESM)
esm-infra yes enabled UA Infra: Extended Security Maintenance (ESM)
fips yes n/a NIST-certified FIPS modules
fips-updates yes n/a Uncertified security updates to FIPS modules
livepatch yes n/a Canonical Livepatch service

NOTICES
Operation in progress: ua attach

Enable services with: ua enable <service>

     Account: <email address hidden>
Subscription: <email address hidden>
csmith@downtown:/tmp$ lxc exec test-27-b -- grep Traceback /var/log/ubuntu-advantage.log
csmith@downtown:/tmp$ lxc exec test-27-b -- ua enable esm-apps
One moment, checking your subscription first
This subscription is not entitled to UA Apps: ESM
For more information see: https://ubuntu.com/advantage.
csmith@downtown:/tmp$ lxc exec test-27-b -- ua detach
Detach will disable the following service:
    esm-infra
Are you sure? (y/N) y
Updating package lists
This machine is now detached.
csmith@downtown:/tmp$ lxc exec test-27-b -- ua attach <REDACTED_WITH_APPS>
Enabling default service esm-apps
Updating package lists
UA Apps: ESM enabled
Enabling default service esm-infra
Updating package lists
UA Infra: ESM enabled
This machine is now attached to 'UA Applications - Essential (Physical)'

SERVICE ENTITLED STATUS DESCRIPTION
cc-eal yes n/a Common Criteria EAL2 Provisioning Packages
cis yes disabled Center for Internet Security Audit Tools
esm-apps yes enabled UA Apps: Extended Security Maintenance (ESM)
esm-infra yes enabled UA Infra: Extended Security Maintenance (ESM)
fips yes n/a NIST-certified FIPS modules
fips-updates yes n/a Uncertified security updates to FIPS modules
livepatch yes n/a ...

Read more...

07e2ac7... by Chad Smith

sync new upstream release 27.0 for bionic release

Revision history for this message
Chad Smith (chad.smith) wrote :
Download full text (5.1 KiB)

re-ran locally with a local sbuild of this branch on bionic
csmith@downtown:~/ $ lxc exec test-27-b -- cloud-init status --wait --long

status: done
time: Wed, 28 Apr 2021 00:09:04 +0000
detail:
DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]
csmith@downtown:~/ $
csmith@downtown:~/ $
csmith@downtown:~/ $
csmith@downtown:~/ $ lxc exec test-27-b -- ua version
27.0~18.04.1 +allow_beta +extra_security_params
csmith@downtown:~/ $ lxc exec test-27-b -- ua status
SERVICE AVAILABLE DESCRIPTION
cc-eal no Common Criteria EAL2 Provisioning Packages
cis yes Center for Internet Security Audit Tools
esm-apps yes UA Apps: Extended Security Maintenance (ESM)
esm-infra yes UA Infra: Extended Security Maintenance (ESM)
fips yes NIST-certified FIPS modules
fips-updates yes Uncertified security updates to FIPS modules
livepatch yes Canonical Livepatch service

This machine is not attached to a UA subscription.
See https://ubuntu.com/advantage
csmith@downtown:~/ $ lxc exec test-27-b -- ua attach <REDACTED_NO_APPS>
Enabling default service esm-infra
Updating package lists
UA Infra: ESM enabled
This machine is now attached to '<email address hidden>'

SERVICE ENTITLED STATUS DESCRIPTION
cc-eal yes n/a Common Criteria EAL2 Provisioning Packages
cis yes disabled Center for Internet Security Audit Tools
esm-apps no — UA Apps: Extended Security Maintenance (ESM)
esm-infra yes enabled UA Infra: Extended Security Maintenance (ESM)
fips yes n/a NIST-certified FIPS modules
fips-updates yes n/a Uncertified security updates to FIPS modules
livepatch yes n/a Canonical Livepatch service

NOTICES
Operation in progress: ua attach

Enable services with: ua enable <service>

     Account: <email address hidden>
Subscription: <email address hidden>
csmith@downtown:~/ $ lxc exec test-27-b -- ua enable esm-apps
One moment, checking your subscription first
This subscription is not entitled to UA Apps: ESM
For more information see: https://ubuntu.com/advantage.
csmith@downtown:~/ $ lxc exec test-27-b -- grep Traceback /var/log/ubuntu-advantage.log
csmith@downtown:~/ $ lxc exec test-27-b -- ua detach
Detach will disable the following service:
    esm-infra
Are you sure? (y/N) y
Updating package lists
This machine is now detached.
csmith@downtown:~/ $ lxc exec test-27-b -- ua attach <REDACTED_WITH_APPS>
Enabling default service esm-apps
Updating package lists
UA Apps: ESM enabled
Enabling default service esm-infra
Updating package lists
UA Infra: ESM enabled
This machine is now attached to 'UA Applications - Essential (Physical)'

SERVICE ENTITLED STATUS DESCRIPTION
cc-eal yes n/a Common Criteria EAL2 Provisioning Packages
cis yes disabled Center for Internet Security Audit Tools
esm-apps yes enabled UA Apps: Extended Security Maintenance (ESM)
esm-infra yes enabled UA Infra: Extended Security Maintenance (ESM)
fips yes n/a NIST-certified FIPS mod...

Read more...

153a74c... by Grant Orndorff

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.

f5c81f1... by Chad Smith

add .gitignore

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

LGTM, tagged and uploaded for bionic.

triage-bionic+18.04:~/pkg/UbuntuAdvantageTools/review-mp401916$ dput ubuntu ubuntu-advantage-tools_27.0~18.04.1_source.changes
Checking signature on .changes
gpg: /home/bryce/pkg/UbuntuAdvantageTools/review-mp401916/ubuntu-advantage-tools_27.0~18.04.1_source.changes: Valid signature from E603B2578FB8F0FB
Checking signature on .dsc
gpg: /home/bryce/pkg/UbuntuAdvantageTools/review-mp401916/ubuntu-advantage-tools_27.0~18.04.1.dsc: Valid signature from E603B2578FB8F0FB
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading ubuntu-advantage-tools_27.0~18.04.1.dsc: done.
  Uploading ubuntu-advantage-tools_27.0~18.04.1.tar.xz: done.
  Uploading ubuntu-advantage-tools_27.0~18.04.1_source.buildinfo: done.
  Uploading ubuntu-advantage-tools_27.0~18.04.1_source.changes: done.
Successfully uploaded packages.
triage-bionic+18.04:~/pkg/UbuntuAdvantageTools/review-mp401916$ cd ubuntu-advantage-tools-gu/
triage-bionic+18.04:~/pkg/UbuntuAdvantageTools/review-mp401916/ubuntu-advantage-tools-gu$ git ubuntu tag --upload
triage-bionic+18.04:~/pkg/UbuntuAdvantageTools/review-mp401916/ubuntu-advantage-tools-gu$ git push -f pkg upload/27.0_18.04.1
Counting objects: 215, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (200/200), done.
Writing objects: 100% (215/215), 331.27 KiB | 498.00 KiB/s, done.
Total 215 (delta 17), reused 91 (delta 7)
remote: Resolving deltas: 100% (17/17), done.
To ssh://git.launchpad.net/ubuntu/+source/ubuntu-advantage-tools
 * [new tag] upload/27.0_18.04.1 -> upload/27.0_18.04.1

review: Approve
8f93c4d... by Grant Orndorff

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.

e119b9e... by Grant Orndorff

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

6b1cfe2... by Grant Orndorff

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

8f91ecc... by Grant Orndorff

tests: fix subp ls error case

7c1d014... by Chad Smith

changelog 27.0.1 & 27.0.2

ae8ff60... by Chad Smith

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

6880d56... by Chad Smith

changelog: 27.0.2~18.04.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/.gitignore b/.gitignore
index 2b2da67..29b86f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,11 @@ ubuntu_advantage_tools.dsc
22# test/jenkins artifacts22# test/jenkins artifacts
23pytest_results.xml23pytest_results.xml
24reports/24reports/
25<<<<<<< .gitignore
26=======
27
28# apt-hook build artifacts
29apt-hook/hook
30apt-hook/ubuntu-advantage.pot
31apt-hook/json-hook-src/json-hook
32>>>>>>> .gitignore
diff --git a/Jenkinsfile b/Jenkinsfile
index 2082e19..925a9c3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -87,7 +87,11 @@ pipeline {
87 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}87 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
88 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}88 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
89 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .89 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
90<<<<<<< Jenkinsfile
90 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc91 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
92=======
93 sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
94>>>>>>> Jenkinsfile
91 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb95 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
92 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb96 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
93 '''97 '''
@@ -108,7 +112,11 @@ pipeline {
108 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}112 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
109 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}113 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
110 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .114 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
115<<<<<<< Jenkinsfile
111 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc116 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
117=======
118 sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
119>>>>>>> Jenkinsfile
112 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb120 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
113 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb121 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
114 '''122 '''
@@ -129,7 +137,11 @@ pipeline {
129 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}137 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
130 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}138 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
131 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .139 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
140<<<<<<< Jenkinsfile
132 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc141 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
142=======
143 sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
144>>>>>>> Jenkinsfile
133 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb145 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
134 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb146 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
135 '''147 '''
@@ -150,7 +162,11 @@ pipeline {
150 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}162 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
151 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}163 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
152 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .164 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
165<<<<<<< Jenkinsfile
153 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc166 sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
167=======
168 sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
169>>>>>>> Jenkinsfile
154 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb170 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
155 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb171 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
156 '''172 '''
diff --git a/apt-hook/Makefile b/apt-hook/Makefile
index 15c4856..16da1bf 100644
--- a/apt-hook/Makefile
+++ b/apt-hook/Makefile
@@ -1,3 +1,24 @@
1<<<<<<< apt-hook/Makefile
2=======
3# the go hook steps will be skipped if this is a nonempty string
4SKIP_GO_HOOK = ""
5
6GO_BIN = $(shell which go)
7# Try go-1.14 and go-1.10 if not in path
8ifeq ($(GO_BIN),)
9 ifneq ($(wildcard /usr/lib/go-1.14/bin/go),)
10 GO_BIN = /usr/lib/go-1.14/bin/go
11 else ifneq ($(wildcard /usr/lib/go-1.10/bin/go),)
12 GO_BIN = /usr/lib/go-1.10/bin/go
13 endif
14endif
15
16# If still not found then just don't build the go hook
17ifeq ($(GO_BIN),)
18 SKIP_GO_HOOK = "1"
19endif
20
21>>>>>>> apt-hook/Makefile
1all: build22all: build
223
3build: hook ubuntu-advantage.pot json-hook24build: hook ubuntu-advantage.pot json-hook
@@ -9,15 +30,27 @@ hook: hook.cc
9 $(CXX) -Wall -Wextra -pedantic -std=c++11 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -g -o hook hook.cc -lapt-pkg $(LDLIBS)30 $(CXX) -Wall -Wextra -pedantic -std=c++11 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -g -o hook hook.cc -lapt-pkg $(LDLIBS)
1031
11json-hook:32json-hook:
33<<<<<<< apt-hook/Makefile
12 cd json-hook-src && GOCACHE=/tmp/ go build json-hook.go34 cd json-hook-src && GOCACHE=/tmp/ go build json-hook.go
35=======
36 [ $(SKIP_GO_HOOK) ] || (cd json-hook-src && GOCACHE=/tmp/ $(GO_BIN) build json-hook.go)
37>>>>>>> apt-hook/Makefile
1338
14install: hook json-hook39install: hook json-hook
15 install -D -m 644 20apt-esm-hook.conf $(DESTDIR)/etc/apt/apt.conf.d/20apt-esm-hook.conf40 install -D -m 644 20apt-esm-hook.conf $(DESTDIR)/etc/apt/apt.conf.d/20apt-esm-hook.conf
16 install -D -m 755 hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-hook41 install -D -m 755 hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-hook
42<<<<<<< apt-hook/Makefile
17 install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook43 install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook
44=======
45 [ $(SKIP_GO_HOOK) ] || install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook
46>>>>>>> apt-hook/Makefile
1847
19clean:48clean:
20 rm -f hook ubuntu-advantage.pot json-hook-src/json-hook49 rm -f hook ubuntu-advantage.pot json-hook-src/json-hook
2150
22test:51test:
52<<<<<<< apt-hook/Makefile
23 cd json-hook-src && go test53 cd json-hook-src && go test
54=======
55 [ $(SKIP_GO_HOOK) ] || (cd json-hook-src && GOCACHE=/tmp/ $(GO_BIN) test)
56>>>>>>> apt-hook/Makefile
diff --git a/apt-hook/json-hook-src/go.mod b/apt-hook/json-hook-src/go.mod
index 66726af..2823e25 100644
--- a/apt-hook/json-hook-src/go.mod
+++ b/apt-hook/json-hook-src/go.mod
@@ -1,3 +1,7 @@
1module json-hook1module json-hook
22
3<<<<<<< apt-hook/json-hook-src/go.mod
3go 1.24go 1.2
5=======
6go 1.7
7>>>>>>> apt-hook/json-hook-src/go.mod
diff --git a/apt-hook/json-hook-src/json-hook.go b/apt-hook/json-hook-src/json-hook.go
index 0f2e3eb..fc6b704 100644
--- a/apt-hook/json-hook-src/json-hook.go
+++ b/apt-hook/json-hook-src/json-hook.go
@@ -45,6 +45,21 @@ type jsonRPC struct {
45 } `json:"params"`45 } `json:"params"`
46}46}
4747
48<<<<<<< apt-hook/json-hook-src/json-hook.go
49=======
50func updatesFromSource(count int, source string, first bool) string {
51 security := ""
52 if first {
53 security = "security "
54 }
55 updates := "updates"
56 if count == 1 {
57 updates = "update"
58 }
59 return fmt.Sprintf("%d %s %s%s", count, source, security, updates)
60}
61
62>>>>>>> apt-hook/json-hook-src/json-hook.go
48func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCount int) string {63func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCount int) string {
49 displayStandard := true64 displayStandard := true
50 displayEsmInfra := true65 displayEsmInfra := true
@@ -72,6 +87,7 @@ func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCo
72 }87 }
7388
74 standardUpdates := ""89 standardUpdates := ""
90<<<<<<< apt-hook/json-hook-src/json-hook.go
75 esmInfraUpdates := ""91 esmInfraUpdates := ""
76 esmAppsUpdates := ""92 esmAppsUpdates := ""
77 if displayStandard {93 if displayStandard {
@@ -118,6 +134,32 @@ func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCo
118 }134 }
119135
120 return standardUpdates + esmInfraUpdates + esmAppsUpdates136 return standardUpdates + esmInfraUpdates + esmAppsUpdates
137=======
138 afterStandard := ""
139 esmInfraUpdates := ""
140 afterInfra := ""
141 esmAppsUpdates := ""
142
143 if displayStandard {
144 standardUpdates = updatesFromSource(standardSecurityCount, "standard", true)
145 if displayEsmInfra && displayEsmApps {
146 afterStandard = ", "
147 } else if displayEsmInfra || displayEsmApps {
148 afterStandard = " and "
149 }
150 }
151 if displayEsmInfra {
152 esmInfraUpdates = updatesFromSource(esmInfraCount, "esm-infra", esmInfraFirst)
153 if displayEsmApps {
154 afterInfra = " and "
155 }
156 }
157 if displayEsmApps {
158 esmAppsUpdates = updatesFromSource(esmAppsCount, "esm-apps", esmAppsFirst)
159 }
160
161 return standardUpdates + afterStandard + esmInfraUpdates + afterInfra + esmAppsUpdates
162>>>>>>> apt-hook/json-hook-src/json-hook.go
121}163}
122164
123func fromOriginAndArchive(pkgVersion jsonRPCPackageVersion, origin string, archive string) bool {165func fromOriginAndArchive(pkgVersion jsonRPCPackageVersion, origin string, archive string) bool {
diff --git a/apt-hook/json-hook-src/json-hook_test.go b/apt-hook/json-hook-src/json-hook_test.go
index cfc1788..135ec2c 100644
--- a/apt-hook/json-hook-src/json-hook_test.go
+++ b/apt-hook/json-hook-src/json-hook_test.go
@@ -14,6 +14,7 @@ func TestCreateUpdateMessages(t *testing.T) {
14 expectedMessage string14 expectedMessage string
15 }15 }
16 testParamsList := []params{16 testParamsList := []params{
17<<<<<<< apt-hook/json-hook-src/json-hook_test.go
17 params{0, 0, 0, ""},18 params{0, 0, 0, ""},
18 params{0, 0, 1, "1 esm-apps security update"},19 params{0, 0, 1, "1 esm-apps security update"},
19 params{0, 0, 2, "2 esm-apps security updates"},20 params{0, 0, 2, "2 esm-apps security updates"},
@@ -41,6 +42,35 @@ func TestCreateUpdateMessages(t *testing.T) {
41 params{2, 2, 0, "2 standard security updates and 2 esm-infra updates"},42 params{2, 2, 0, "2 standard security updates and 2 esm-infra updates"},
42 params{2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"},43 params{2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"},
43 params{2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"},44 params{2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"},
45=======
46 {0, 0, 0, ""},
47 {0, 0, 1, "1 esm-apps security update"},
48 {0, 0, 2, "2 esm-apps security updates"},
49 {0, 1, 0, "1 esm-infra security update"},
50 {0, 1, 1, "1 esm-infra security update and 1 esm-apps update"},
51 {0, 1, 2, "1 esm-infra security update and 2 esm-apps updates"},
52 {0, 2, 0, "2 esm-infra security updates"},
53 {0, 2, 1, "2 esm-infra security updates and 1 esm-apps update"},
54 {0, 2, 2, "2 esm-infra security updates and 2 esm-apps updates"},
55 {1, 0, 0, "1 standard security update"},
56 {1, 0, 1, "1 standard security update and 1 esm-apps update"},
57 {1, 0, 2, "1 standard security update and 2 esm-apps updates"},
58 {1, 1, 0, "1 standard security update and 1 esm-infra update"},
59 {1, 1, 1, "1 standard security update, 1 esm-infra update and 1 esm-apps update"},
60 {1, 1, 2, "1 standard security update, 1 esm-infra update and 2 esm-apps updates"},
61 {1, 2, 0, "1 standard security update and 2 esm-infra updates"},
62 {1, 2, 1, "1 standard security update, 2 esm-infra updates and 1 esm-apps update"},
63 {1, 2, 2, "1 standard security update, 2 esm-infra updates and 2 esm-apps updates"},
64 {2, 0, 0, "2 standard security updates"},
65 {2, 0, 1, "2 standard security updates and 1 esm-apps update"},
66 {2, 0, 2, "2 standard security updates and 2 esm-apps updates"},
67 {2, 1, 0, "2 standard security updates and 1 esm-infra update"},
68 {2, 1, 1, "2 standard security updates, 1 esm-infra update and 1 esm-apps update"},
69 {2, 1, 2, "2 standard security updates, 1 esm-infra update and 2 esm-apps updates"},
70 {2, 2, 0, "2 standard security updates and 2 esm-infra updates"},
71 {2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"},
72 {2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"},
73>>>>>>> apt-hook/json-hook-src/json-hook_test.go
44 }74 }
4575
46 for i, testParams := range testParamsList {76 for i, testParams := range testParamsList {
@@ -62,7 +92,11 @@ func TestCountSecurityUpdates(t *testing.T) {
62 expectedEsmAppsCount int92 expectedEsmAppsCount int
63 }93 }
64 testParamsList := []params{94 testParamsList := []params{
95<<<<<<< apt-hook/json-hook-src/json-hook_test.go
65 params{mockJson, 1, 2, 3},96 params{mockJson, 1, 2, 3},
97=======
98 {mockJson, 1, 2, 3},
99>>>>>>> apt-hook/json-hook-src/json-hook_test.go
66 }100 }
67101
68 for i, testParams := range testParamsList {102 for i, testParams := range testParamsList {
diff --git a/debian/changelog b/debian/changelog
index 5f3f53a..ca5de47 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,25 @@
1<<<<<<< debian/changelog
2=======
3ubuntu-advantage-tools (27.0.2~18.04.1) bionic; urgency=medium
4
5 * d/control:
6 - order build-depends alternatives newer first (LP: #1926949)
7 - apt-hook: do not attempt to package go APT JSON hook on some
8 architectures (GH: #1603) (LP: #1927795)
9 * Bug-fix release 27.0.2: build failures on riscv64 and powerpc
10 - apt-hook: refactor json hook messaging to be dry
11 - tests: fix subp ls error case for powerpc builds
12 - jenkinsfile: add --resolve-alternatives for trusty builds
13
14 -- Chad Smith <chad.smith@canonical.com> Fri, 07 May 2021 11:58:03 -0600
15
16ubuntu-advantage-tools (27.0.1) impish; urgency=medium
17
18 * Add .gitignore and cleanup ignored directory .pytest_cache
19
20 -- Chad Smith <chad.smith@canonical.com> Fri, 07 May 2021 11:55:07 -0600
21
22>>>>>>> debian/changelog
1ubuntu-advantage-tools (27.0~18.04.1) bionic; urgency=medium23ubuntu-advantage-tools (27.0~18.04.1) bionic; urgency=medium
224
3 * New upstream release 27.0: (LP: #1926361)25 * New upstream release 27.0: (LP: #1926361)
diff --git a/debian/control b/debian/control
index cd28a1f..660a80d 100644
--- a/debian/control
+++ b/debian/control
@@ -6,10 +6,17 @@ Build-Depends: bash-completion,
6 debhelper (>=9),6 debhelper (>=9),
7 debianutils,7 debianutils,
8 dh-python,8 dh-python,
9<<<<<<< debian/control
9 dh-systemd | debhelper (>= 13.3),10 dh-systemd | debhelper (>= 13.3),
10 gettext,11 gettext,
11 git,12 git,
12 golang,13 golang,
14=======
15 debhelper (>= 13.3) | dh-systemd,
16 gettext,
17 git,
18 golang-go (>= 2:1.14~) [!powerpc] | golang-1.14-go [!powerpc] | golang-1.10-go [!powerpc !riscv64],
19>>>>>>> debian/control
13 libapt-pkg-dev,20 libapt-pkg-dev,
14 po-debconf,21 po-debconf,
15 python3 (>= 3.4),22 python3 (>= 3.4),
diff --git a/debian/rules b/debian/rules
index 9bea522..3ac2b02 100755
--- a/debian/rules
+++ b/debian/rules
@@ -27,6 +27,10 @@ override_dh_auto_build:
2727
28override_dh_auto_test:28override_dh_auto_test:
29ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))29ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
30<<<<<<< debian/rules
31=======
32 make -C apt-hook test
33>>>>>>> debian/rules
30 python3 -m pytest34 python3 -m pytest
31ifdef FLAKE835ifdef FLAKE8
32 # required for Trusty: flake8 does not install a __main__ for -m36 # required for Trusty: flake8 does not install a __main__ for -m
diff --git a/uaclient/tests/test_util.py b/uaclient/tests/test_util.py
index 019faf2..cfba8c8 100644
--- a/uaclient/tests/test_util.py
+++ b/uaclient/tests/test_util.py
@@ -291,11 +291,20 @@ class TestSubp:
291 with pytest.raises(util.ProcessExecutionError) as excinfo:291 with pytest.raises(util.ProcessExecutionError) as excinfo:
292 util.subp(["ls", "--bogus"])292 util.subp(["ls", "--bogus"])
293293
294<<<<<<< uaclient/tests/test_util.py
294 expected_error = (295 expected_error = (
295 "Failed running command 'ls --bogus' [exit(2)]."296 "Failed running command 'ls --bogus' [exit(2)]."
296 " Message: ls: unrecognized option"297 " Message: ls: unrecognized option"
297 )298 )
298 assert expected_error in str(excinfo.value)299 assert expected_error in str(excinfo.value)
300=======
301 expected_errors = [
302 "Failed running command 'ls --bogus' [exit(2)].",
303 "ls: unrecognized option '--bogus'",
304 ]
305 for msg in expected_errors:
306 assert msg in str(excinfo.value)
307>>>>>>> uaclient/tests/test_util.py
299 assert 0 == m_sleep.call_count # no retries308 assert 0 == m_sleep.call_count # no retries
300309
301 @mock.patch("uaclient.util.time.sleep")310 @mock.patch("uaclient.util.time.sleep")

Subscribers

People subscribed via source and target branches

to status/vote changes: