From: David Galloway Date: Thu, 20 Mar 2025 20:34:09 +0000 (-0400) Subject: tools: Exclude `option host-name` from grep hostname in set-next-server X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e759ffc8b4ce66fe9149b2dd40b7178ab053597b;p=ceph-cm-ansible.git tools: Exclude `option host-name` from grep hostname in set-next-server Otherwise, the `linenum=` line gets two line numbers. Signed-off-by: David Galloway --- diff --git a/tools/set-next-server.sh b/tools/set-next-server.sh index 866a7d6..1eb2e76 100644 --- a/tools/set-next-server.sh +++ b/tools/set-next-server.sh @@ -37,7 +37,7 @@ fogip="172.21.0.72" fogfilename="/undionly.kpxe" macaddr=$(sed -n "/host ${host}-front/,/}/p" $dhcpconfig | grep 'hardware ethernet' | awk '{ print $3 }' | tr -d ';') ipaddr=$(sed -n "/host ${host}-front/,/}/p" $dhcpconfig | grep 'fixed-address' | awk '{ print $2 }' | tr -d ';') -linenum=$(grep -n $host $dhcpconfig | cut -d ':' -f1) +linenum=$(grep -n $host $dhcpconfig | grep -v "host-name" | cut -d ':' -f1) if [ -z "$macaddr" ]; then echo "No MAC address found for $host"