motd-news: use wget instead of curl
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
base-files (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Andreas Hasenack | ||
Bionic |
Fix Released
|
Undecided
|
Andreas Hasenack | ||
Focal |
Fix Released
|
Undecided
|
Andreas Hasenack |
Bug Description
[Impact]
The motd-news script is using curl, but since that is an optional package, there is no guarantee that it will be installed. The script correctly checks for its presence before trying to use it, though, so it won't fail. As we don't want to add such a dependency to the base-files package, we should switch to wget, which is standard.
[Test Case]
wget has a different behavior than curl in some areas, one of which is crucial for the motd-per-cloud feature. While curl will only complain about a 404 from the server if given a specific parameter (-f), wget does that by default, and needs special handling.
a) With curl, base-files and ubuntu-server installed, first verify motd-news works:
$ sudo /etc/update-
* Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with
sudo snap install microk8s --channel=
https:/
Now remove curl, and retry. It should exit immediately with no output:
$ sudo /etc/update-
Install the updated base-files package and the new motd-news-config package from proposed:
$ sudo apt install base-files motd-news-config
Note curl is still not available:
$ curl
Command 'curl' not found, but can be installed with:
sudo apt install curl
Re-run the motd-news script, this time it should produce output again:
$ sudo /etc/update-
* Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with
sudo snap install microk8s --channel=
https:/
b) Verify motd-news per cloud remains working.
If you have /usr/bin/cloud-id, copy it to a backup:
sudo cp /usr/bin/
Create a new one, per supported cloud. For aws, for example:
echo -e '#!/bin/sh\necho aws' | sudo tee /usr/bin/cloud-id
Confirm by running it:
$ cloud-id
aws
And confirm motd-news keeps working (it might return different content):
$ sudo /etc/update-
* Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with
sudo snap install microk8s --channel=
https:/
Repeat for the gce and azure clouds, by changing the cloud-id script accordingly.
To confirm the right cloud_id is being used, use sh -x and grep for its output:
$ sudo sh -x /etc/update-
+ wget --timeout 60 -U wget/1.
This also verifies again it's using wget instead of curl.
[Regression Potential]
Possible regressions will likely be tied to a difference in behavior between curl and wget. In fact, one was caught[1] in the development release and the fix is included here, with a test.
[Other Info]
N/A
Related branches
- Canonical Server Core Reviewers: Pending requested
- Canonical Server: Pending requested
-
Diff: 234 lines (+95/-0) (has conflicts)9 files modifieddebian/base-files.maintscript (+4/-0)
debian/changelog (+40/-0)
debian/control (+9/-0)
debian/motd-news-config.postinst (+8/-0)
debian/postinst.in (+12/-0)
etc/issue (+4/-0)
etc/issue.net (+4/-0)
etc/lsb-release (+6/-0)
etc/os-release (+8/-0)
- Christian Ehrhardt (community): Approve
- Canonical Server: Pending requested
-
Diff: 362 lines (+197/-15)10 files modifieddebian/changelog (+35/-0)
debian/conffiles (+0/-1)
debian/control (+13/-1)
debian/motd-news-config.conffiles (+1/-0)
debian/motd-news-config.postinst (+50/-0)
debian/postinst.in (+19/-0)
debian/postrm (+6/-0)
debian/preinst (+34/-0)
debian/rules (+19/-4)
debian/update-motd.d/50-motd-news (+20/-9)
- Christian Ehrhardt (community): Approve
- Canonical Server: Pending requested
-
Diff: 254 lines (+137/-11)8 files modifieddebian/base-files.maintscript (+2/-0)
debian/changelog (+33/-0)
debian/control (+13/-1)
debian/motd-news-config.install (+1/-0)
debian/motd-news-config.postinst (+55/-0)
debian/postinst.in (+13/-0)
debian/rules (+0/-1)
update-motd.d/50-motd-news (+20/-9)
- Christian Ehrhardt (community): Approve
- Canonical Server: Pending requested
-
Diff: 252 lines (+137/-11)8 files modifieddebian/base-files.maintscript (+1/-0)
debian/changelog (+33/-0)
debian/control (+14/-1)
debian/motd-news-config.install (+1/-0)
debian/motd-news-config.postinst (+55/-0)
debian/postinst.in (+13/-0)
debian/rules (+0/-1)
motd/50-motd-news (+20/-9)
This was fixed for groovy in https:/ /launchpad. net/ubuntu/ +source/ base-files/ 11ubuntu9