parent
cd89f280b7
commit
6085109171
|
@ -412,7 +412,6 @@ EOF
|
||||||
declare failOnFailure="$6"
|
declare failOnFailure="$6"
|
||||||
declare arrayName="$7"
|
declare arrayName="$7"
|
||||||
|
|
||||||
# This check should eventually be moved to cloud provider specific script
|
|
||||||
if [ "$publicIp" = "TERMINATED" ] || [ "$privateIp" = "TERMINATED" ]; then
|
if [ "$publicIp" = "TERMINATED" ] || [ "$privateIp" = "TERMINATED" ]; then
|
||||||
if $failOnFailure; then
|
if $failOnFailure; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -36,6 +36,17 @@ __cloud_FindInstances() {
|
||||||
--filter "$filter" \
|
--filter "$filter" \
|
||||||
--format 'value(name,networkInterfaces[0].accessConfigs[0].natIP,networkInterfaces[0].networkIP,status,zone)' \
|
--format 'value(name,networkInterfaces[0].accessConfigs[0].natIP,networkInterfaces[0].networkIP,status,zone)' \
|
||||||
| grep RUNNING)
|
| grep RUNNING)
|
||||||
|
|
||||||
|
while read -r name status zone; do
|
||||||
|
privateIp=TERMINATED
|
||||||
|
publicIp=TERMINATED
|
||||||
|
printf "%-30s | publicIp=%-16s privateIp=%s status=%s zone=%s\n" "$name" "$publicIp" "$privateIp" "$status" "$zone"
|
||||||
|
|
||||||
|
instances+=("$name:$publicIp:$privateIp:$zone")
|
||||||
|
done < <(gcloud compute instances list \
|
||||||
|
--filter "$filter" \
|
||||||
|
--format 'value(name,status,zone)' \
|
||||||
|
| grep TERMINATED)
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -251,6 +262,9 @@ cloud_WaitForInstanceReady() {
|
||||||
# declare instanceZone="$3"
|
# declare instanceZone="$3"
|
||||||
declare timeout="$4"
|
declare timeout="$4"
|
||||||
|
|
||||||
|
if [[ $instanceIp = "TERMINATED" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
timeout "${timeout}"s bash -c "set -o pipefail; until ping -c 3 $instanceIp | tr - _; do echo .; done"
|
timeout "${timeout}"s bash -c "set -o pipefail; until ping -c 3 $instanceIp | tr - _; do echo .; done"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +282,10 @@ cloud_FetchFile() {
|
||||||
declare localFile="$4"
|
declare localFile="$4"
|
||||||
declare zone="$5"
|
declare zone="$5"
|
||||||
|
|
||||||
|
if [[ $publicIp = "TERMINATED" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
gcloud compute scp --zone "$zone" "$instanceName:$remoteFile" "$localFile"
|
gcloud compute scp --zone "$zone" "$instanceName:$remoteFile" "$localFile"
|
||||||
|
|
Loading…
Reference in New Issue