Merge ~ahasenack/ubuntu/+source/base-files:bionic-motd-news-per-cloud into ubuntu/+source/base-files:ubuntu/bionic-devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: Andreas Hasenack
Approved revision: e40500be779d94fca56523bdbe9b1678c952bf30
Merged at revision: e40500be779d94fca56523bdbe9b1678c952bf30
Proposed branch: ~ahasenack/ubuntu/+source/base-files:bionic-motd-news-per-cloud
Merge into: ubuntu/+source/base-files:ubuntu/bionic-devel
Diff against target: 62 lines (+22/-3)
2 files modified
debian/changelog (+7/-0)
update-motd.d/50-motd-news (+15/-3)
Reviewer Review Type Date Requested Status
Bryce Harrington (community) Approve
Canonical Server Core Reviewers Pending
Review via email: mp+373413@code.launchpad.net

Description of the change

Bring in the per-cloud motd support, which adds the cloud_id/<name> string to the user-agent. This is a direct cherry-pick from the change that is in eoan already, with the exception that in eoan the script is located in the motd/ directory, and not update-motd/, in the source tree.

Testing instructions are in the SRU bug #1840946

Test PPA is at https://launchpad.net/~ahasenack/+archive/ubuntu/motd-news-per-cloud-sru:

sudo add-apt-repository -y ppa:ahasenack/motd-news-per-cloud-sru(

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Completed review of the motd changes, including running the test cases in a bionic lxd container. One suggested technical change for numerical comparisons (ok by me to fix with the upload), but otherwise rest LGTM. Tests worked as expected on bionic.

  - [√] changelog entry correct, targeted to correct codename
  - [√] version number correct
  - [√] update-maintainer has been run
  - [~] patches match what was proposed upstream
  - [~] patches correctly included in debian/patches/series?
  - [~] patches have correct DEP3 metadata
  - [~] autopkgtest passes
  - [√] test case a: confirm Kata Containers motd
        sudo sh /etc/update-motd.d/50-motd-news --force
  - [√] test case b: confirm cloud_id set in user-agent to "cloud_id/lxd"
 sudo sh -x /etc/update-motd.d/50-motd-news --force 2>&1| grep -E "curl .*cloud_id/"
  - [√] test case c: list timers to confirm motd-news is active
        ... 10h left Tue 2019-10-01 17:15:33 UTC 1h 20min ago motd-news.timer motd-news.service

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks, tagging and uploading e40500be779d94fca56523bdbe9b1678c952bf30

$ git push pkg upload/10.1ubuntu2.7
Enumerating objects: 18, done.
Counting objects: 100% (18/18), done.
Delta compression using up to 2 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 1.59 KiB | 125.00 KiB/s, done.
Total 13 (delta 9), reused 0 (delta 0)
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/base-files
 * [new tag] upload/10.1ubuntu2.7 -> upload/10.1ubuntu2.7

$ dput ubuntu ../base-files_10.1ubuntu2.7_source.changes
Checking signature on .changes
gpg: ../base-files_10.1ubuntu2.7_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../base-files_10.1ubuntu2.7.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading base-files_10.1ubuntu2.7.dsc: done.
  Uploading base-files_10.1ubuntu2.7.tar.xz: done.
  Uploading base-files_10.1ubuntu2.7_source.buildinfo: done.
  Uploading base-files_10.1ubuntu2.7_source.changes: done.
Successfully uploaded packages.

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 10f8a29..3ad65e4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1base-files (10.1ubuntu2.7) bionic; urgency=medium
2
3 * update-motd.d/50-motd-news: add cloud_id to user-agent string
4 (LP: #1840946)
5
6 -- Andreas Hasenack <andreas@canonical.com> Fri, 27 Sep 2019 15:24:34 -0300
7
1base-files (10.1ubuntu2.6) bionic; urgency=medium8base-files (10.1ubuntu2.6) bionic; urgency=medium
29
3 * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump10 * /etc/issue, /etc/issue.net, /etc/lsb-release, /etc/os-release: Bump
diff --git a/update-motd.d/50-motd-news b/update-motd.d/50-motd-news
index e031cdf..08d7f0d 100644
--- a/update-motd.d/50-motd-news
+++ b/update-motd.d/50-motd-news
@@ -67,7 +67,8 @@ fi
67# Generate our temp files, clean up when done67# Generate our temp files, clean up when done
68NEWS=$(mktemp) || exit 168NEWS=$(mktemp) || exit 1
69ERR=$(mktemp) || exit 169ERR=$(mktemp) || exit 1
70trap "rm -f $NEWS $ERR" HUP INT QUIT ILL TRAP KILL BUS TERM70CLOUD=$(mktemp) || exit 1
71trap "rm -f $NEWS $ERR $CLOUD" HUP INT QUIT ILL TRAP KILL BUS TERM
7172
72# Construct a user agent, similar to Firefox/Chrome/Safari/IE to73# Construct a user agent, similar to Firefox/Chrome/Safari/IE to
73# ensure a proper, tailored, accurate message of the day74# ensure a proper, tailored, accurate message of the day
@@ -84,13 +85,24 @@ codename="$DISTRIB_CODENAME"
84platform="$(uname -o)/$(uname -r)/$(uname -m)"85platform="$(uname -o)/$(uname -r)/$(uname -m)"
85arch="$(uname -m)"86arch="$(uname -m)"
86cpu="$(grep -m1 "^model name" /proc/cpuinfo | sed -e "s/.*: //" -e "s:\s\+:/:g")"87cpu="$(grep -m1 "^model name" /proc/cpuinfo | sed -e "s/.*: //" -e "s:\s\+:/:g")"
88cloud_id="unknown"
89if [ -x /usr/bin/cloud-id ]; then
90 /usr/bin/cloud-id > "$CLOUD" 2>/dev/null
91 if [ $? -eq 0 ]; then
92 # sanitize it a bit, just in case
93 cloud_id=$(cut -c -40 "${CLOUD}" | tr -c -d '[:alnum:]')
94 if [ -z "${cloud_id}" ]; then
95 cloud_id="unknown"
96 fi
97 fi
98fi
8799
88# Some messages may only be pertinent before or after some amount of uptime100# Some messages may only be pertinent before or after some amount of uptime
89read up idle < /proc/uptime101read up idle < /proc/uptime
90uptime="uptime/$up/$idle"102uptime="uptime/$up/$idle"
91103
92# Piece together the user agent104# Piece together the user agent
93USER_AGENT="curl/$curl_ver $lsb $platform $cpu $uptime"105USER_AGENT="curl/$curl_ver $lsb $platform $cpu $uptime cloud_id/$cloud_id"
94106
95# Loop over any configured URLs107# Loop over any configured URLs
96for u in $URLS; do108for u in $URLS; do
@@ -119,5 +131,5 @@ for u in $URLS; do
119 : > "$CACHE"131 : > "$CACHE"
120 fi132 fi
121done133done
122rm -f "$NEWS" "$ERR"134rm -f "$NEWS" "$ERR" "$CLOUD"
123exit 0135exit 0

Subscribers

People subscribed via source and target branches