Check if ${NOMAD_DC} is undefined or unset 74/65274/5 v0.57.1
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 2 Sep 2020 04:27:35 +0000 (14:27 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 2 Sep 2020 23:00:42 +0000 (09:00 +1000)
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 <abelur@linuxfoundation.org>
releasenotes/notes/fix-capture-instance-metadata-script-e130cc297c189976.yaml [new file with mode: 0644]
shell/capture-instance-metadata.sh

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 (file)
index 0000000..3ba334c
--- /dev/null
@@ -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.
index cb0081f..23a9f2b 100644 (file)
@@ -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