X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fcapture-instance-metadata.sh;h=a5e0051c2ecf8dd8e598848a449733fe16c88b61;hb=4867c0799530acf13f7527c6a026879bdfb34e06;hp=c102d53c3ee67b3f2c0c3010c1d775fd365c89e4;hpb=86f276e966e01b037d96a1a87cb6ad1fce18f7cc;p=releng%2Fglobal-jjb.git diff --git a/shell/capture-instance-metadata.sh b/shell/capture-instance-metadata.sh index c102d53c..a5e0051c 100644 --- a/shell/capture-instance-metadata.sh +++ b/shell/capture-instance-metadata.sh @@ -11,6 +11,17 @@ echo "---> capture-instance-metadata.sh" +# shellcheck disable=SC1090 +source ~/lf-env.sh + +if [[ "${PYTHON:-}" -ne "" ]]; then + lf-activate-venv --python "$PYTHON" lftools +elif python3; then + lf-activate-venv --python python3 lftools +else + lf-activate-venv lftools +fi + # detect if we're in EC2 if [ -n "${NOMAD_DC}" ]; then echo "INFO: Running in Nomad, no metadata" @@ -25,8 +36,8 @@ 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 + echo "INFO: Running in AWS, not capturing instance metadata" + exit 0 fi # Retrive OpenStack instace metadata APIs at this IP.