ACK:[autotest-client-tests][PATCH] UBUNTU: SAUCE: ubuntu_fan_smoke_test: use resolvectl for parsing DNS server by default
Sean Feole
sean.feole at canonical.com
Mon Mar 21 13:13:06 UTC 2022
+1 from me, thanks sam!
Sean
On 3/21/22 7:43 AM, Po-Hsu Lin wrote:
> Some SUT will have more than one DNS server, example below is the
> output from node spitfire with Focal in Intel MAAS:
> Current DNS Server: 8.8.8.8
> DNS Servers: 192.168.102.22
> 8.8.8.8
> DNS Domain: maas
>
> In this case, this script will get 192.168.102.22 for systems that
> comes with systemd-resolve, but the test will fail with:
> Could not resolve 'security.ubuntu.com'
>
> Using the Current DNS Server instead can solve this issue. But this
> property does not exist before Focal. The solution is to use
> resolvectl by default and parse for "Current DNS Server", while still
> using the systemd-resolve to parse for "DNS Servers" in older release.
>
> Patch tested with X/B/F/I on bare-metal MAAS, F/J on Intel MAAS
>
> Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
> ---
> ubuntu_fan_smoke_test/smoke_test_old.sh | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/ubuntu_fan_smoke_test/smoke_test_old.sh b/ubuntu_fan_smoke_test/smoke_test_old.sh
> index 990a6804..8ad8ae54 100755
> --- a/ubuntu_fan_smoke_test/smoke_test_old.sh
> +++ b/ubuntu_fan_smoke_test/smoke_test_old.sh
> @@ -142,16 +142,16 @@ fanatic_docker_test()
> dns_opt=""
> dns1=$(awk '$1=="nameserver"{print $2; exit}' /etc/resolv.conf)
> if [ "$dns1" = "127.0.0.53" ]; then
> - if command -v systemd-resolve 2>&1 > /dev/null; then
> + if command -v resolvectl 2>&1 > /dev/null; then
> + dns_opt="--dns=$(resolvectl status |
> + sed -n "0,/Current DNS/s/^.*Current DNS Server: //p")"
> + else
> dns_opt="--dns=$(systemd-resolve --status |
> awk '/DNS Servers:/{
> sub(/.*DNS Servers: */, "")
> sub(/,.*/, "")
> print
> exit}')"
> - else
> - dns_opt="--dns=$(resolvectl status |
> - sed -n "0,/Current DNS/s/^.*Current DNS Server: //p")"
> fi
> echo -n "($dns_opt): "
> else
More information about the kernel-team
mailing list