Update to how zone is extracted from metadata

This commit is contained in:
Dan Isla 2017-07-29 08:20:58 -07:00 committed by GitHub
parent c2f142eea3
commit 00797cc23b
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ GetMetadata () {
echo "$(curl -f -H "Metadata-Flavor: Google" ${BASEMETADATAURL}/${1} 2> /dev/null)" echo "$(curl -f -H "Metadata-Flavor: Google" ${BASEMETADATAURL}/${1} 2> /dev/null)"
} }
ZONE=$(GetMetadata zone | grep -oP "[^/]*$") ZONE=$(basename $(GetMetadata zone))
SetMetadata () { SetMetadata () {
gcloud compute instances add-metadata ${HOSTNAME} --metadata ${1}=${2} --zone ${ZONE} gcloud compute instances add-metadata ${HOSTNAME} --metadata ${1}=${2} --zone ${ZONE}