2022-10-10 08:21:17 -04:00
|
|
|
#!/usr/bin/env bash
|
2022-09-05 12:12:46 -04:00
|
|
|
|
2022-11-10 04:28:35 -05:00
|
|
|
set -euo pipefail
|
|
|
|
shopt -s inherit_errexit
|
2022-10-31 05:40:08 -04:00
|
|
|
|
2023-07-13 10:28:33 -04:00
|
|
|
echo "Using Zone: ${1}"
|
|
|
|
echo "Using Constellation UID: ${2}"
|
2022-10-31 05:40:08 -04:00
|
|
|
|
2023-07-13 10:28:33 -04:00
|
|
|
allInstances=$(
|
|
|
|
gcloud compute instances list \
|
|
|
|
--filter="labels.constellation-uid=${2}" \
|
|
|
|
--format=json | yq eval '.[] | .name' -
|
2022-12-08 10:55:56 -05:00
|
|
|
)
|
2022-11-10 04:28:35 -05:00
|
|
|
|
2022-12-08 10:55:56 -05:00
|
|
|
for instance in ${allInstances}; do
|
2023-07-13 10:28:33 -04:00
|
|
|
printf "Fetching for %s\n" "${instance}"
|
2022-12-08 10:55:56 -05:00
|
|
|
gcloud compute instances get-serial-port-output "${instance}" \
|
2022-09-05 12:12:46 -04:00
|
|
|
--port 1 \
|
|
|
|
--start 0 \
|
2023-07-13 10:28:33 -04:00
|
|
|
--zone "${1}" > "${instance}".log
|
2022-09-05 12:12:46 -04:00
|
|
|
done
|