]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
tools: Exclude `option host-name` from grep hostname in set-next-server 775/head
authorDavid Galloway <david.galloway@ibm.com>
Thu, 20 Mar 2025 20:34:09 +0000 (16:34 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Thu, 20 Mar 2025 20:34:09 +0000 (16:34 -0400)
Otherwise, the `linenum=` line gets two line numbers.

Signed-off-by: David Galloway <david.galloway@ibm.com>
tools/set-next-server.sh

index 866a7d6a89c684b66f9b8c77560cb46b604f652d..1eb2e765ac3990c365fe047595d480da2b4a24f4 100644 (file)
@@ -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"