From 50b6737cb8b73ea2311b2992e7dfd6611f60b07c Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Wed, 2 Sep 2020 14:27:35 +1000 Subject: [PATCH] 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 --- .../fix-capture-instance-metadata-script-e130cc297c189976.yaml | 8 ++++++++ shell/capture-instance-metadata.sh | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-capture-instance-metadata-script-e130cc297c189976.yaml 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 -- 2.16.6