From 4308689b6132fa15165556607b554b92b3b805cd Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Fri, 15 Nov 2024 09:51:36 -0300 Subject: [PATCH] Use socket.gethostbyaddr to define hostname. --- tests/sanity/runtest.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tests/sanity/runtest.sh b/tests/sanity/runtest.sh index ead6a1e..a618a61 100644 --- a/tests/sanity/runtest.sh +++ b/tests/sanity/runtest.sh @@ -1,14 +1,6 @@ #!/bin/sh -eux -dnshost="$(hostname)" -if command -v dig >/dev/null -then - hostip="$(dig +short $(hostname))" - if [ -n "${hostip}" ] - then - dnshost="$(dig +short -x "${hostip}" | sed "s/\(.*\)\./\1/")" - fi -fi +dnshost="$(echo "import socket; print(socket.gethostbyaddr('$(hostname)')[0])" | "$(command -v python3)")" systemctl unmask gssproxy ipa-server-install --hostname=${dnshost} -r EXAMPLE.TEST -n example.test --setup-dns --no-forwarders --allow-zone-overlap -p Secret123 -a Secret123 -U echo Secret123 | kinit admin