From 5ebc1a76d045f391683f63fc1d639201f3ea03c1 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:41:58 -0400 Subject: [PATCH] Restandardize arguments to checkin --- templates/install.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/templates/install.sh b/templates/install.sh index 96ae97b..abce91d 100755 --- a/templates/install.sh +++ b/templates/install.sh @@ -143,11 +143,9 @@ seed_checkin() ( action="install-complete" ;; esac - macaddr=$( ip -br link show ${target_interface} | awk '{ print $3 }' ) - ipaddr=$( ip -br address show ${target_interface} | awk '{ print $3 }' | awk -F '/' '{ print $1 }' ) curl -X POST \ -H "Content-Type: application/json" \ - -d "{\"action\":\"${action}\",\"macaddr\":\"${macaddr}\",\"ipaddr\":\"${ipaddr}\",\"hostname\":\"${target_hostname}\",\"bmc_macaddr\":\"${bmc_macaddr}\",\"bmc_ipaddr\":\"${bmc_ipaddr}\"}" \ + -d "{\"action\":\"${action}\",\"hostname\":\"${target_hostname}\",\"host_macaddr\":\"${host_macaddr}\",\"host_ipaddr\":\"${host_ipaddr}\",\"bmc_macaddr\":\"${bmc_macaddr}\",\"bmc_ipaddr\":\"${bmc_ipaddr}\"}" \ ${pvcbootstrapd_checkin_uri} >&2 ) @@ -209,6 +207,9 @@ seed_config() { target_route="$( ip route show to match ${seed_host} | grep 'scope link' )" target_interface="$( grep -E -o 'e[a-z]+[0-9]+[a-z0-9]*' <<<"${target_route}" )" + host_macaddr=$( ip -br link show ${target_interface} | awk '{ print $3 }' ) + host_ipaddr=$( ip -br address show ${target_interface} | awk '{ print $3 }' | awk -F '/' '{ print $1 }' ) + # Handle the target disk if [[ -n ${target_disk_path} ]]; then target_disk="$( realpath ${target_disk_path} )" @@ -834,8 +835,8 @@ case ${install_option} in #!/usr/bin/env bash target_interface=\${1} pvcbootstrapd_checkin_uri="${pvcbootstrapd_checkin_uri}" -macaddr=\$( ip -br link show \${target_interface} | awk '{ print \$3 }' ) -ipaddr=\$( ip -br address show \${target_interface} | awk '{ print \$3 }' | awk -F '/' '{ print \$1 }' ) +host_macaddr=\$( ip -br link show \${target_interface} | awk '{ print \$3 }' ) +host_ipaddr=\$( ip -br address show \${target_interface} | awk '{ print \$3 }' | awk -F '/' '{ print \$1 }' ) bmc_macaddr=\$( ipmitool lan print | grep 'MAC Address ' | awk '{ print \$NF }' ) bmc_ipaddr=\$( ipmitool lan print | grep 'IP Address ' | awk '{ print \$NF }' ) if [[ -f /etc/pvc-install.hooks ]]; then @@ -850,7 +851,7 @@ else fi curl -X POST \ -H "Content-Type: application/json" \ - -d "{\"action\":\"\${action}\",\"macaddr\":\"\${macaddr}\",\"ipaddr\":\"\${ipaddr}\",\"hostname\":\"\$( hostname -s )\",\"bmc_macaddr\":\"\${bmc_macaddr}\",\"bmc_ipaddr\":\"\${bmc_ipaddr}\"}" \ + -d "{\"action\":\"\${action}\",\"hostname\":\"\$( hostname -s )\",\"host_macaddr\":\"\${host_macaddr}\",\"host_ipaddr\":\"\${host_ipaddr}\",\"bmc_macaddr\":\"\${bmc_macaddr}\",\"bmc_ipaddr\":\"\${bmc_ipaddr}\"}" \ \${pvcbootstrapd_checkin_uri} if [[ \${action} == "system-boot_completed" ]]; then