** Description changed:

- 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.
+ [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-motd.d/50-motd-news --force
+ 
+  * Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with
+    sudo snap install microk8s --channel=1.19/candidate --classic
+ 
+    https://microk8s.io/ has docs and details.
+ 
+ Now remove curl, and retry. It should exit immediately with no output:
+ 
+ $ sudo /etc/update-motd.d/50-motd-news --force
+ 
+ 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-motd.d/50-motd-news --force
+ 
+  * Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with
+    sudo snap install microk8s --channel=1.19/candidate --classic
+ 
+    https://microk8s.io/ has docs and details.
+ 
+ b) Verify motd-news per cloud remains working.
+ If you have /usr/bin/cloud-id, copy it to a backup:
+ sudo cp /usr/bin/cloud-id{,.orig}
+ 
+ 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-motd.d/50-motd-news --force
+ 
+  * Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with
+    sudo snap install microk8s --channel=1.19/candidate --classic
+ 
+    https://microk8s.io/ has docs and details.
+ 
+ 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-motd.d/50-motd-news --force 2>&1 | grep -wE 'wget 
.*cloud_id/[a-z]+'
+ + wget --timeout 60 -U wget/1.20.3-1ubuntu1 Ubuntu/20.04.1/LTS 
GNU/Linux/5.4.0-42-generic/x86_64 Intel(R)/Core(TM)/i7-7600U/CPU/@/2.80GHz 
cloud_id/azure -O- --content-on-error https://motd.ubuntu.com
+ 
+ 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
+ 
+ 1. https://bugs.launchpad.net/bugs/1889117

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1888572

Title:
  motd-news: use wget instead of curl

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/1888572/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to