Fix job cost amazon exception 26/65126/3
authorAric Gardner <agardner@linuxfoundation.org>
Mon, 17 Aug 2020 20:03:58 +0000 (16:03 -0400)
committerAric Gardner <agardner@linuxfoundation.org>
Thu, 20 Aug 2020 18:22:57 +0000 (14:22 -0400)
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 <agardner@linuxfoundation.org>
Change-Id: I57e27fe5bb2135e738b33c0f6de78f1759bcb93d

shell/job-cost.sh

index cb5f1a5..595b342 100644 (file)
@@ -16,7 +16,8 @@ set -euf -o pipefail
 source ~/lf-env.sh
 
 # AWS job cost not supported, exit
-if grep -qi amazon /sys/devices/virtual/dmi/id/bios_vendor ; then
+cloudtype="$(jq -r .v1.datasource /run/cloud-init/result.json)"
+if [[ $cloudtype == "DataSourceEc2Local" ]]; then
   echo "INFO: Not able to calculate job cost on AWS"
   exit 0
 fi