From dab37be485b3848cf7d9b86d5b65282b8583a210 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Thu, 18 Nov 2021 10:45:58 -0500 Subject: [PATCH] Update get-vm-ips.sh to work with new map config. --- get-vm-ips.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/get-vm-ips.sh b/get-vm-ips.sh index 8eceb68..230b5cf 100755 --- a/get-vm-ips.sh +++ b/get-vm-ips.sh @@ -22,7 +22,7 @@ IPS_JSON="$( # An array of all node "types" NODE_TYPE_ARRAY="$( echo $IPS_JSON | \ - jq '.key' | \ + jq '.value.value | to_entries | .[] | .key' | \ sed 's/"//g' | \ sed -z 's/\n/ /g;s/ $/\n/g')" @@ -32,12 +32,12 @@ VM_IP_EXPORTS="$( # Convert type, converts "master-ips" to "MASTER" TYPE_UPPER="$(echo ${TYPE^^} | sed s/_.*$//g)" - echo "$OUTPUTS_JSON" | \ - jq '.'"$TYPE"'.value[]' | \ + echo "$IPS_JSON" | \ + jq '.value.value.'"$TYPE"'[]' | \ # Add line numbers starting with 0. nl -v 0 | \ # Print an export string with a type placeholder "__TYPE__". - awk '{print "export __TYPE__" $1 "=" $2}' | \ + awk '{print "export __TYPE___" $1 "=" $2}' | \ sed s/__TYPE__/$TYPE_UPPER/g done)"