From: Anil Belur Date: Wed, 2 Sep 2020 04:27:35 +0000 (+1000) Subject: Check if ${NOMAD_DC} is undefined or unset X-Git-Tag: v0.57.1^0 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?p=releng%2Fglobal-jjb.git;a=commitdiff_plain;h=50b6737cb8b73ea2311b2992e7dfd6611f60b07c Check if ${NOMAD_DC} is undefined or unset The condition in the commit 31a4b7fc00fe90494b6efb512ad0f1db02481ff3 should instead check when the environment variable $NOMAD_DC is not defined or unset, this avoids the script from exiting without capturing instance metadata. Issue: RELENG-3142 Change-Id: I80240d77abfacb59c81e41e63629468350e24b7b Signed-off-by: Anil Belur --- diff --git a/releasenotes/notes/fix-capture-instance-metadata-script-e130cc297c189976.yaml b/releasenotes/notes/fix-capture-instance-metadata-script-e130cc297c189976.yaml new file mode 100644 index 00000000..3ba334c6 --- /dev/null +++ b/releasenotes/notes/fix-capture-instance-metadata-script-e130cc297c189976.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Check condition when ${NOMAD_DC} is undefined or unset + + Check if the environment variable $NOMAD_DC is not defined or unset, + this avoids the script from exiting without capturing instance + metadata. diff --git a/shell/capture-instance-metadata.sh b/shell/capture-instance-metadata.sh index cb0081fd..23a9f2bf 100644 --- a/shell/capture-instance-metadata.sh +++ b/shell/capture-instance-metadata.sh @@ -12,7 +12,7 @@ echo "---> capture-instance-metadata.sh" # detect if we're in EC2 -if [ -z "${NOMAD_DC}" ]; then +if [ -n "${NOMAD_DC}" ]; then echo "INFO: Running in Nomad, no metadata" exit 0 fi