Update get-vm-ips.sh to work with new map config.
This commit is contained in:
+4
-4
@@ -22,7 +22,7 @@ IPS_JSON="$(
|
|||||||
# An array of all node "types"
|
# An array of all node "types"
|
||||||
NODE_TYPE_ARRAY="$(
|
NODE_TYPE_ARRAY="$(
|
||||||
echo $IPS_JSON | \
|
echo $IPS_JSON | \
|
||||||
jq '.key' | \
|
jq '.value.value | to_entries | .[] | .key' | \
|
||||||
sed 's/"//g' | \
|
sed 's/"//g' | \
|
||||||
sed -z 's/\n/ /g;s/ $/\n/g')"
|
sed -z 's/\n/ /g;s/ $/\n/g')"
|
||||||
|
|
||||||
@@ -32,12 +32,12 @@ VM_IP_EXPORTS="$(
|
|||||||
|
|
||||||
# Convert type, converts "master-ips" to "MASTER"
|
# Convert type, converts "master-ips" to "MASTER"
|
||||||
TYPE_UPPER="$(echo ${TYPE^^} | sed s/_.*$//g)"
|
TYPE_UPPER="$(echo ${TYPE^^} | sed s/_.*$//g)"
|
||||||
echo "$OUTPUTS_JSON" | \
|
echo "$IPS_JSON" | \
|
||||||
jq '.'"$TYPE"'.value[]' | \
|
jq '.value.value.'"$TYPE"'[]' | \
|
||||||
# Add line numbers starting with 0.
|
# Add line numbers starting with 0.
|
||||||
nl -v 0 | \
|
nl -v 0 | \
|
||||||
# Print an export string with a type placeholder "__TYPE__".
|
# 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
|
sed s/__TYPE__/$TYPE_UPPER/g
|
||||||
done)"
|
done)"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user