Merge ~chad.smith/ubuntu/+source/pollinate:ubuntu/trusty-devel into ubuntu/+source/pollinate:ubuntu/trusty-devel

Proposed by Chad Smith
Status: Merged
Approved by: Scott Moser
Approved revision: fea72054afecce6ded3f6a307a6c58322b8d080b
Merge reported by: Scott Moser
Merged at revision: fea72054afecce6ded3f6a307a6c58322b8d080b
Proposed branch: ~chad.smith/ubuntu/+source/pollinate:ubuntu/trusty-devel
Merge into: ubuntu/+source/pollinate:ubuntu/trusty-devel
Diff against target: 303 lines (+219/-14)
4 files modified
ChangeLog (+84/-2)
debian/changelog (+13/-0)
pollinate (+119/-12)
pollinate.1 (+3/-0)
Reviewer Review Type Date Requested Status
Scott Moser (community) Approve
Review via email: mp+347073@code.launchpad.net

Commit message

Upstream snapshot of pollinate 4.33 into trusty devel. No packaging behavior changes made.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

We're missing the ChangeLog changes that came from upstream.

Then, for the debian/changelog new entries i had a comment below. Yours is fine for sure.

Revision history for this message
Scott Moser (smoser) wrote :

Filed and fixed bug 1774043.

I'm OK with either option here:
a.) new upstream release of 4.33 and upload to cosmic, then SRU that
b.) cherry-pick the patch to debian/patches/ for trusty.

Revision history for this message
Chad Smith (chad.smith) :
Revision history for this message
Chad Smith (chad.smith) :
Revision history for this message
Scott Moser (smoser) wrote :

I always kind of struggle for what a SRU changelog
should look like. If someone is using trusty and is reading changelogs
then they're interested in changes that they see. So the
'include img/build_name/server in user-agent' is not speficially new
as it is covered by 'Add cloud image build info'.

The same is true of 'fix bug on xen....' that never existed in trusty.
Obviously writing such a changelog means different changelogs for
each release we're doing an SRU to, and is generally more complex for
you. But does seem to me at least to provide more value to the user.

An example of a trusty and xenial changelog might be.
 * New upstream release (LP: #1761240):
   - Add hypervisor to useragent string
   - Add cloud image build info and data in /etc/pollinate/add-user-agent
     to useragent string.
   - Add '--print-user-agent' flag.
   - Speedups when collecting information for user-agent.
   - Get logger version via logger -V rather than dpkg query.
   - Perform safe read of /proc/uptime

Artful would be the same except for the 'Perform safe read..'
and bionic would have:
  - Use systemd-detect-virt if available.
  - Fix bug on xen when not booted with systemd.
  - Include img/build_name/server in user-agent.

fea7205... by Chad Smith

Import version 4.33-0ubuntu1~14.04.1 to ubuntu/trusty-proposed

New changelog entries:
  * New upstream release (LP: #1761240):
    - Add '--print-user-agent' flag.
    - Speedups when collecting information for user-agent.
    - Add hypervisor to useragent string
    - Get logger version via logger -V rather than dpkg query.
    - Add cloud image build info and data in /etc/pollinate/add-user-agent
      to user-agent string.
    - Perform as safe read of /proc/uptime

Revision history for this message
Scott Moser (smoser) wrote :

I made a small change here, to the changelog, just to clean up english:
- - Perform as safe read of /proc/uptime
+ - Perform a safe read of /proc/uptime

And then uploaded and changed trusty-updates to just trusty.

https://code.launchpad.net/~smoser/ubuntu/+source/pollinate/+git/pollinate/+ref/bug/1761240-sru-trusty

review: Approve
Revision history for this message
Scott Moser (smoser) wrote :

marking merged as uploaded to queue.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/ChangeLog b/ChangeLog
index b0fe4c3..40a1039 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,86 @@
1pollinate (4.25) released; urgency=medium1pollinate (4.33) released; urgency=medium
2
3 * pollinate: fix bug on xen when not booted with systemd. user-agent
4 would contain virt/virt/xen rather than virt/xen. (LP: #1774043)
5 * pollinate: use systemd-detect-virt if available rather than detecting
6 its availability based on /run/systemd.
7
8 -- Scott Moser <smoser@ubuntu.com> Fri, 25 May 2018 12:30:15 -0400
9
10pollinate (4.32-0ubuntu1) cosmic; urgency=medium
11
12 * pollinate: include img/build_name/server in user-agent.
13
14 -- Scott Moser <smoser@ubuntu.com> Fri, 25 May 2018 12:30:06 -0400
15
16pollinate (4.31-0ubuntu1) bionic; urgency=medium
17
18 [ Scott Moser ]
19 * pollinate: add '--print-user-agent' flag.
20 * pollinate: Speedups when collecting information for user-agent.
21
22 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 14 Feb 2018 11:01:18 -0600
23
24pollinate (4.30-0ubuntu1) bionic; urgency=medium
25
26 * debian/pollinate.postinst:
27 - don't try to chown a dir to the user, potentially before the user exists
28
29 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 31 Jan 2018 07:24:33 -0600
30
31pollinate (4.29-0ubuntu1) bionic; urgency=medium
32
33 * No change rebuild, release error in 4.28
34
35 -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 30 Jan 2018 16:41:13 -0600
36
37pollinate (4.28-0ubuntu1) bionic; urgency=medium
38
39 [ Dustin Kirkland ]
40 * pollinate:
41 - add hypervisor to useragent string
42 * debian/pollinate.postinst:
43 - ensure that the pollinate user owns /var/cache/pollinate;
44 to be safe, we're going to do this just after the mkdir, and
45 after the adduser;
46 this avoids the warning:
47 + adduser: Warning: The home directory /var/cache/pollinate
48 does not belong to the user you are currently creating.
49
50 [ Steve Langasek ]
51 * Minor enhancements to pollinate runtime:
52 - dpkg | awk is unnecessary, dpkg-query --showformat does this
53 * dpkg -l is a fairly heavyweight operation (.1s); ask logger directly
54 what its version number is (.01s)
55
56 [ Scott Moser ]
57 * pollinate:
58 - Add cloud image build info and data in /etc/pollinate/add-user-agent.
59 - Use systemd-detect-virt and namespace virt/<type> in useragent
60
61 -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 30 Jan 2018 16:31:24 -0600
62
63pollinate (4.27-0ubuntu1) artful; urgency=medium
64
65 * Fixup maintscript & version missmatch from the previous upload.
66
67 -- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 18 Aug 2017 13:13:16 +0100
68
69pollinate (4.26-0ubuntu1) artful; urgency=medium
70
71 [ Scott Moser ]
72 * Perform as safe read of /proc/uptime LP: #1708461
73
74 [ Dimitri John Ledkov ]
75 * Drop upstart system job
76 * Drop no longer needed build-deps, and redundantly specified essential
77 bsdutils
78 * Fix spelling typo in the description
79 * Bump debhelper compat to 9, previous levels are deprecated
80
81 -- Dustin Kirkland <kirkland@ubuntu.com> Sat, 14 Jan 2017 08:45:46 +0100
82
83pollinate (4.25-0ubuntu1) zesty; urgency=medium
284
3 [ Stefano Rivera ]85 [ Stefano Rivera ]
4 * debian/control: Add missing dependency on xxd. (LP: #1656484)86 * debian/control: Add missing dependency on xxd. (LP: #1656484)
@@ -6,7 +88,7 @@ pollinate (4.25) released; urgency=medium
6 [ Dustin Kirkland ]88 [ Dustin Kirkland ]
7 * debian/control: xxd is provided by vim-common in older Ubuntu releases89 * debian/control: xxd is provided by vim-common in older Ubuntu releases
890
9 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 02 Nov 2016 14:47:01 +020091 -- Dustin Kirkland <kirkland@ubuntu.com> Sat, 14 Jan 2017 08:45:44 +0100
1092
11pollinate (4.24-0ubuntu1) zesty; urgency=medium93pollinate (4.24-0ubuntu1) zesty; urgency=medium
1294
diff --git a/debian/changelog b/debian/changelog
index 48eb078..0220678 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
1pollinate (4.33-0ubuntu1~14.04.1) trusty-updates; urgency=medium
2
3 * New upstream release (LP: #1761240):
4 - Add '--print-user-agent' flag.
5 - Speedups when collecting information for user-agent.
6 - Add hypervisor to useragent string
7 - Get logger version via logger -V rather than dpkg query.
8 - Add cloud image build info and data in /etc/pollinate/add-user-agent
9 to user-agent string.
10 - Perform as safe read of /proc/uptime
11
12 -- Chad Smith <chad.smith@canonical.com> Wed, 30 May 2018 10:22:11 -0600
13
1pollinate (4.25-0ubuntu1~14.04.1) trusty; urgency=medium14pollinate (4.25-0ubuntu1~14.04.1) trusty; urgency=medium
215
3 * New upstream release (LP: #1708192):16 * New upstream release (LP: #1708192):
diff --git a/pollinate b/pollinate
index a69cd9f..4a4cbbd 100755
--- a/pollinate
+++ b/pollinate
@@ -17,6 +17,7 @@
17# along with this program. If not, see <http://www.gnu.org/licenses/>.17# along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19set -e19set -e
20set -f
2021
21PKG="pollinate"22PKG="pollinate"
22TMPDIR=$(mktemp -d -t "${PKG}.XXXXXXXXXXXX")23TMPDIR=$(mktemp -d -t "${PKG}.XXXXXXXXXXXX")
@@ -28,8 +29,8 @@ HOSTNAME=$(hostname)
28STRICT=029STRICT=0
2930
30# Only recent logger version supports --id=[ID]31# Only recent logger version supports --id=[ID]
31logger_ver=$(dpkg -l bsdutils | tail -n1 | awk '{print $3}')32logger_ver=$(logger -V 2>&1 | awk '{print $4}')
32dpkg --compare-versions $logger_ver ge 1:2.26.2 && LOGGER="logger --id=$$" || LOGGER="logger"33dpkg --compare-versions $logger_ver ge 2.26.2 && LOGGER="logger --id=$$" || LOGGER="logger"
33# Log to both syslog, and stderr, if we're on an interactive terminal34# Log to both syslog, and stderr, if we're on an interactive terminal
34[ -t 0 ] && LOGGER="$LOGGER -s"35[ -t 0 ] && LOGGER="$LOGGER -s"
3536
@@ -88,20 +89,121 @@ hash_and_write() {
88 log "client hashed response from [${1}]"89 log "client hashed response from [${1}]"
89}90}
9091
92read_build_info() {
93 # ubuntu images place build information in /etc/cloud/build.info
94 # format of file is '<key>: <value>' put these under img/<key>/<value>
95 local bifile="${1:-/etc/cloud/build.info}" ret=""
96 _RET=""
97 [ -s "$bifile" ] || return 0
98 ret=$(awk '{
99 gsub(/#.*/, ""); gsub(/\s+$/, "");
100 if ($0 == "" || $0 !~ /:/) next;
101 gsub(/:\s*/, "/");
102 printf("img/%s ", $0) }' "$bifile") || return
103 _RET="${ret% }"
104}
105
106read_addl_info() {
107 # allow additinal info file to contain entries one per line. lines must
108 # have a '/' in them. remove trailing space and '#' as comment. example:
109 # key/value
110 # fookey/foovalue # written by foo
111 local aifile="${1:-/etc/pollinate/add-user-agent}" ret=""
112 _RET=""
113 [ -s "$aifile" ] || return 0
114 ret=$(awk '{
115 gsub(/#.*/, ""); gsub(/\s+$/, "");
116 if ($0 == "" || $0 !~ /\//) next;
117 printf("%s ", $0); }' "$aifile") || return
118 _RET=${ret% }
119}
120
121read_virt() {
122 # return virt/<value> where value is the virtualization platform the
123 # system is running on.
124 local ret=""
125 _RET=""
126 if command -v systemd-detect-virt >/dev/null; then
127 ret=$(systemd-detect-virt)
128 # systemd-detect-virt returns 1 for 'none'
129 [ $? -eq 0 -o "$ret" = "none" ] || ret=""
130 else
131 # trusty would take this path.
132 if [ -d /dev/xen ]; then
133 ret="xen"
134 elif [ -d /dev/lxd ]; then
135 # call this 'lxc' for consistency with systemd-detect-virt.
136 ret="lxc"
137 elif dmesg | grep --quiet " kvm-clock:"; then
138 ret="kvm"
139 fi
140 fi
141 [ -n "$ret" ] || return
142 _RET="virt/$ret"
143}
144
145read_package_versions() {
146 local pkgs="pollinate curl cloud-init" data="" p=""
147 data=$(dpkg-query \
148 -W --showformat='${Package}/${Version} ' $pkgs 2>/dev/null) || :
149 # fill in 'package/' for any package not installed.
150 for p in ${pkgs}; do
151 [ "${data#*$p/}" = "$data" ] && data="${data} $p/"
152 done
153 if [ -n "$TESTING" ]; then
154 p="pollinate"
155 data="${data%%$p/*}$p${TESTING}/${data#*$p/}"
156 fi
157 set -- $data
158 _RET="$*"
159}
160
161read_uname_info() {
162 # taken from cloud-init ds-identify.
163 # run uname, and parse output.
164 # uname is tricky to parse as it outputs always in a given order
165 # independent of option order. kernel-version is known to have spaces.
166 # 1 -s kernel-name
167 # 2 -n nodename
168 # 3 -r kernel-release
169 # 4.. -v kernel-version(whitespace)
170 # N-2 -m machine
171 # N-1 -o operating-system
172 local out="" krel="" machine="" os=""
173 out=$(uname -snrvmo) || { _RET=""; return; }
174 set -- $out
175 krel="$3"
176 shift 3
177 while [ $# -gt 2 ]; do
178 shift
179 done
180 machine=$1
181 os=$2
182 _RET="$os/$krel/$machine"
183 return 0
184}
185
91user_agent() {186user_agent() {
92 # Construct a user agent, with useful debug information187 # Construct a user agent, with useful debug information
93 # Very similar to Firefox and Chrome188 # Very similar to Firefox and Chrome
94 local pollinate_ver="$(dpkg -l pollinate | awk '$1 == "ii" { print($3); exit(0); }')"189
95 local curl_ver="$(dpkg -l curl | awk '$1 == "ii" { print($3); exit(0); }')"
96 local cloud_init_ver="$(dpkg -l cloud-init 2>/dev/null | awk '$1 == "ii" { print($3); exit(0); }')"
97 . /etc/lsb-release190 . /etc/lsb-release
98 local lsb=$(echo "${DISTRIB_DESCRIPTION}" | sed -e "s/ /\//g")191
99 local platform="$(uname -o)/$(uname -r)/$(uname -m)"192 local pkg_info="" lsb="" platform="" cpu="" up="NA" idle="NA" uptime
100 local cpu="$(grep -m1 "^model name" /proc/cpuinfo | sed -e "s/.*: //" -e "s:\s\+:/:g")"193 read_package_versions && pkg_info="$_RET"
101 local up idle194 read_uname_info && platform="$_RET"
102 read up idle < /proc/uptime195
103 local uptime="uptime/$up/$idle"196 lsb=$(echo "${DISTRIB_DESCRIPTION}" | sed -e "s/ /\//g")
104 USER_AGENT="pollinate${TESTING}/${pollinate_ver} curl/${curl_ver} cloud-init/${cloud_init_ver} ${lsb} ${platform} ${cpu} ${uptime}"197 cpu="$(grep -m1 "^model name" /proc/cpuinfo | sed -e "s/.*: //" -e "s:\s\+:/:g")"
198 { read up idle < /proc/uptime ; } >/dev/null 2>&1 || :
199 uptime="uptime/$up/$idle"
200
201 local addl_data="" build_info="" virt=""
202 read_build_info && build_info="${_RET}"
203 read_addl_info && addl_data="${_RET}"
204 read_virt && virt="${_RET}"
205
206 USER_AGENT="${pkg_info} ${lsb} ${platform} ${cpu} ${uptime}${virt:+ ${virt}}${build_info:+ ${build_info}}${addl_data:+ ${addl_data}}"
105}207}
106208
107exchange() {209exchange() {
@@ -203,6 +305,11 @@ while [ ! -z "$1" ]; do
203 WAIT="$2"305 WAIT="$2"
204 shift 2306 shift 2
205 ;;307 ;;
308 --print-user-agent)
309 user_agent || error "Failed to get user-agent."
310 echo "${USER_AGENT}"
311 exit
312 ;;
206 *)313 *)
207 error "Unknown options [$1]"314 error "Unknown options [$1]"
208 ;;315 ;;
diff --git a/pollinate.1 b/pollinate.1
index f7890ee..8e2b9ce 100644
--- a/pollinate.1
+++ b/pollinate.1
@@ -45,6 +45,9 @@ silence any log messages
45.TP45.TP
46\fB-w|--wait\fP WAIT46\fB-w|--wait\fP WAIT
47time in seconds you're willing to wait for a response from the server, uses \fBtimeout\fP(1)47time in seconds you're willing to wait for a response from the server, uses \fBtimeout\fP(1)
48.TP
49\fB --print-user-agent\fP
50Print the user-agent that is used and exit immediately.
4851
49.SH SEE ALSO52.SH SEE ALSO
50\fBpollen\fP(8), \fBtimeout\fP(1)53\fBpollen\fP(8), \fBtimeout\fP(1)

Subscribers

People subscribed via source and target branches