X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fcapture-instance-metadata.sh;h=0998dd1af2beddb8bbc6db94d3ee4c1b7714d951;hb=refs%2Ftags%2Fv0.70.1;hp=23a9f2bf74c42e14a7f7a01b4be8acf4e67cf671;hpb=50b6737cb8b73ea2311b2992e7dfd6611f60b07c;p=releng%2Fglobal-jjb.git diff --git a/shell/capture-instance-metadata.sh b/shell/capture-instance-metadata.sh index 23a9f2bf..0998dd1a 100644 --- a/shell/capture-instance-metadata.sh +++ b/shell/capture-instance-metadata.sh @@ -17,8 +17,14 @@ if [ -n "${NOMAD_DC}" ]; then exit 0 fi -# detect if we're in AWS -if grep -qi amazon /sys/devices/virtual/dmi/id/bios_vendor ; then +if [[ ! -f /run/cloud-init/result.json ]]; then + echo "INFO: Running in unsupported cloud, no metadata" + exit 0 +fi + +# AWS not supported, exit +cloudtype="$(jq -r .v1.datasource /run/cloud-init/result.json)" +if [[ $cloudtype == "DataSourceEc2Local" ]]; then echo "INFO: Running in AWS, not capturing instance metadata" exit 0 fi