Fix ShellCheck v0.4.7 lint issues 21/8321/5
authorAnil Belur <abelur@linuxfoundation.org>
Tue, 9 Jan 2018 23:37:00 +0000 (09:37 +1000)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 10 Jan 2018 03:42:41 +0000 (22:42 -0500)
v0.4.7 introduces some new rules which now need to be handled.

Change-Id: If87fceb79e384e26f021a9c85a2e9d7413ce421e
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
19 files changed:
.jjb-test/expected-xml/gerrit-ciman-packer-merge-centos-java-builder
.jjb-test/expected-xml/gerrit-ciman-packer-merge-centos-mininet
.jjb-test/expected-xml/gerrit-ciman-packer-merge-ubuntu1604-java-builder
.jjb-test/expected-xml/gerrit-ciman-packer-merge-ubuntu1604-mininet
.jjb-test/expected-xml/gerrit-maven-maven-merge-master
.jjb-test/expected-xml/gerrit-maven-maven-verify-deps-master-mvn33-openjdk8
.jjb-test/expected-xml/gerrit-python-tox-verify-master
.jjb-test/expected-xml/github-ciman-packer-merge-centos-java-builder
.jjb-test/expected-xml/github-ciman-packer-merge-centos-mininet
.jjb-test/expected-xml/github-ciman-packer-merge-ubuntu1604-java-builder
.jjb-test/expected-xml/github-ciman-packer-merge-ubuntu1604-mininet
.jjb-test/expected-xml/github-maven-maven-merge-master
.jjb-test/expected-xml/github-python-tox-verify-master
ensure-documented.sh
shell/gerrit-fetch-dependencies.sh
shell/maven-build-deps.sh
shell/maven-deploy.sh
shell/packer-build.sh
shell/tox-run.sh

index 7888a6c..2dac4ca 100644 (file)
@@ -388,7 +388,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 10091bf..40b09ef 100644 (file)
@@ -388,7 +388,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 2aff753..d1af8b1 100644 (file)
@@ -388,7 +388,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 63f727c..902f52a 100644 (file)
@@ -388,7 +388,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index f64dc74..47b0ba8 100644 (file)
@@ -491,8 +491,9 @@ nexus_repo_url=&quot;$NEXUS_URL/content/repositories/$NEXUS_REPO&quot;
 
 # Remove metadata files that were not updated.
 set +e  # Temporarily disable to run diff command.
-metadata_files=($(diff -s -r &quot;$m2repo_dir&quot; &quot;$WORKSPACE/m2repo-backup&quot; \
-    | grep 'Files .* and .* are identical' | awk '{print $2}'))
+IFS=&quot; &quot; read -r -a metadata_files &lt;&lt;&lt; &quot;$(diff -s -r &quot;$m2repo_dir&quot; &quot;$WORKSPACE/m2repo-backup&quot; \
+    | grep 'Files .* and .* are identical' \
+    | awk '{print $2}')&quot;
 set -e  # Re-enable.
 
 set +u  # $metadata_files could be unbound if project is new.
index 107f2ce..13edea6 100644 (file)
@@ -263,7 +263,7 @@ set -eu -o pipefail
 
 REPOS_DIR=&quot;$WORKSPACE/.repos&quot;
 
-PATCHES=($(echo &quot;$GERRIT_EVENT_COMMENT_TEXT&quot; | grep 'recheck:' | awk -F: '{print $2}'))
+IFS=&quot; &quot; read -r -a PATCHES &lt;&lt;&lt; &quot;$(echo &quot;$GERRIT_EVENT_COMMENT_TEXT&quot; | grep 'recheck:' | awk -F: '{print $2}')&quot;
 
 projects=()
 for patch in $(echo &quot;${PATCHES[@]}&quot;); do
@@ -340,7 +340,7 @@ echo &quot;$MAVEN_OPTIONS&quot;
 set -e -o pipefail
 set +u
 
-PROJECTS=($(echo &quot;$DEPENDENCY_BUILD_ORDER&quot;))
+IFS=&quot; &quot; read -r -a PROJECTS &lt;&lt;&lt; &quot;$DEPENDENCY_BUILD_ORDER&quot;
 REPOS_DIR=&quot;$WORKSPACE/.repos&quot;
 
 export MAVEN_OPTS
index da945ce..5573a88 100644 (file)
@@ -340,7 +340,7 @@ run_tox() {
     fi
 }
 
-TOX_ENVS=(${TOX_ENVS//,/ })
+IFS=&quot; &quot; read -r -a TOX_ENVS &lt;&lt;&lt; &quot;${TOX_ENVS//,/ }&quot;
 if hash parallel 2&gt;/dev/null; then
     export -f run_tox
     parallel --jobs 200% &quot;run_tox $ARCHIVE_TOX_DIR {}&quot; ::: ${TOX_ENVS[*]}
@@ -351,7 +351,7 @@ else
 fi
 
 if [ -f &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot; ]; then
-    failed_envs=($(cat &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot;))
+    mapfile -t failed_envs &lt; &lt;(cat &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot;)
     for e in &quot;${failed_envs[@]}&quot;; do
         echo &quot;cat $ARCHIVE_TOX_DIR/tox-$e.log&quot;
         cat &quot;$ARCHIVE_TOX_DIR/tox-$e.log&quot;
index 7463d75..91ba067 100644 (file)
@@ -346,7 +346,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index a9fbdcc..18fe98f 100644 (file)
@@ -346,7 +346,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 35b4aaa..146d342 100644 (file)
@@ -346,7 +346,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 1bd65ad..8870c48 100644 (file)
@@ -346,7 +346,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index f5e708c..47cd9fd 100644 (file)
@@ -449,8 +449,9 @@ nexus_repo_url=&quot;$NEXUS_URL/content/repositories/$NEXUS_REPO&quot;
 
 # Remove metadata files that were not updated.
 set +e  # Temporarily disable to run diff command.
-metadata_files=($(diff -s -r &quot;$m2repo_dir&quot; &quot;$WORKSPACE/m2repo-backup&quot; \
-    | grep 'Files .* and .* are identical' | awk '{print $2}'))
+IFS=&quot; &quot; read -r -a metadata_files &lt;&lt;&lt; &quot;$(diff -s -r &quot;$m2repo_dir&quot; &quot;$WORKSPACE/m2repo-backup&quot; \
+    | grep 'Files .* and .* are identical' \
+    | awk '{print $2}')&quot;
 set -e  # Re-enable.
 
 set +u  # $metadata_files could be unbound if project is new.
index 88b6909..6d758b8 100644 (file)
@@ -302,7 +302,7 @@ run_tox() {
     fi
 }
 
-TOX_ENVS=(${TOX_ENVS//,/ })
+IFS=&quot; &quot; read -r -a TOX_ENVS &lt;&lt;&lt; &quot;${TOX_ENVS//,/ }&quot;
 if hash parallel 2&gt;/dev/null; then
     export -f run_tox
     parallel --jobs 200% &quot;run_tox $ARCHIVE_TOX_DIR {}&quot; ::: ${TOX_ENVS[*]}
@@ -313,7 +313,7 @@ else
 fi
 
 if [ -f &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot; ]; then
-    failed_envs=($(cat &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot;))
+    mapfile -t failed_envs &lt; &lt;(cat &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot;)
     for e in &quot;${failed_envs[@]}&quot;; do
         echo &quot;cat $ARCHIVE_TOX_DIR/tox-$e.log&quot;
         cat &quot;$ARCHIVE_TOX_DIR/tox-$e.log&quot;
index a2ca072..cab15fc 100755 (executable)
@@ -11,7 +11,7 @@
 
 # Checks for JJB documentation interest points and ensures they are documented.
 
-jjb_files=($(find jjb -name "*.yaml"))
+mapfile -t jjb_files < <(find jjb -name "*.yaml")
 
 undocumented_count=0
 for file in "${jjb_files[@]}"; do
index 4870b10..e9c337c 100644 (file)
@@ -22,7 +22,7 @@ set -eu -o pipefail
 
 REPOS_DIR="$WORKSPACE/.repos"
 
-PATCHES=($(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep 'recheck:' | awk -F: '{print $2}'))
+IFS=" " read -r -a PATCHES <<< "$(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep 'recheck:' | awk -F: '{print $2}')"
 
 projects=()
 for patch in $(echo "${PATCHES[@]}"); do
index bf53bf5..5cf2663 100644 (file)
@@ -20,7 +20,7 @@
 set -e -o pipefail
 set +u
 
-PROJECTS=($(echo "$DEPENDENCY_BUILD_ORDER"))
+IFS=" " read -r -a PROJECTS <<< "$DEPENDENCY_BUILD_ORDER"
 REPOS_DIR="$WORKSPACE/.repos"
 
 export MAVEN_OPTS
index fc8e246..15928ee 100644 (file)
@@ -22,8 +22,9 @@ nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO"
 
 # Remove metadata files that were not updated.
 set +e  # Temporarily disable to run diff command.
-metadata_files=($(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \
-    | grep 'Files .* and .* are identical' | awk '{print $2}'))
+IFS=" " read -r -a metadata_files <<< "$(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \
+    | grep 'Files .* and .* are identical' \
+    | awk '{print $2}')"
 set -e  # Re-enable.
 
 set +u  # $metadata_files could be unbound if project is new.
index 714cd33..e730545 100644 (file)
@@ -31,7 +31,7 @@ export PACKER_LOG_PATH="$PACKER_BUILD_LOG" && \
                         "../packer/templates/$PACKER_TEMPLATE.json"
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' "../packer/templates/$PACKER_TEMPLATE.json"))
+mapfile -t clouds < <(jq -r '.builders[].name' "../packer/templates/$PACKER_TEMPLATE.json")
 
 # Split public/private clouds logs
 for cloud in "${clouds[@]}"; do
index 45cb1f2..e8172b2 100644 (file)
@@ -37,7 +37,7 @@ run_tox() {
     fi
 }
 
-TOX_ENVS=(${TOX_ENVS//,/ })
+IFS=" " read -r -a TOX_ENVS <<< "${TOX_ENVS//,/ }"
 if hash parallel 2>/dev/null; then
     export -f run_tox
     parallel --jobs 200% "run_tox $ARCHIVE_TOX_DIR {}" ::: ${TOX_ENVS[*]}
@@ -48,7 +48,7 @@ else
 fi
 
 if [ -f "$ARCHIVE_TOX_DIR/failed-envs.log" ]; then
-    failed_envs=($(cat "$ARCHIVE_TOX_DIR/failed-envs.log"))
+    mapfile -t failed_envs < <(cat "$ARCHIVE_TOX_DIR/failed-envs.log")
     for e in "${failed_envs[@]}"; do
         echo "cat $ARCHIVE_TOX_DIR/tox-$e.log"
         cat "$ARCHIVE_TOX_DIR/tox-$e.log"