From: Aric Gardner Date: Tue, 22 Sep 2020 20:51:59 +0000 (-0400) Subject: Fix capture-instance-metadata.sh X-Git-Tag: v0.57.4~4 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=ac18bc16fef4450781919dacedee149b092588b8;p=releng%2Fglobal-jjb.git Fix capture-instance-metadata.sh bios_vendor file now says Xen, no amazon string to match on any longer. cat /sys/devices/virtual/dmi/id/bios_vendor Xen however result.json has the info we need. /run/cloud-init/result.json { "v1": { "datasource": "DataSourceEc2Local", "errors": [] } } Issue-Id: RELENG-3163 Signed-off-by: Aric Gardner Change-Id: Iece691579622608616a6abc8d27b9ca7653ad9ae --- diff --git a/shell/capture-instance-metadata.sh b/shell/capture-instance-metadata.sh index 23a9f2bf..a5914ad9 100644 --- a/shell/capture-instance-metadata.sh +++ b/shell/capture-instance-metadata.sh @@ -17,10 +17,11 @@ 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 - echo "INFO: Running in AWS, not capturing instance metadata" - exit 0 +# 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 # Retrive OpenStack instace metadata APIs at this IP.