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