From 8b810c6a4d80112a2d07cc5599984403d590579d Mon Sep 17 00:00:00 2001
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Fri, 8 Sep 2017 21:19:01 +0200
Subject: bash scripts: Fix remaining shellcheck warn/errs

Fix/silence all shellcheck errors, except for scripts in
<prototypes/sfc_tacker>.

Change-Id: Idc317cdba0f69b78299f2d3665e72ffc19dd8af5
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 mcp/config/states/maas | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'mcp/config/states/maas')

diff --git a/mcp/config/states/maas b/mcp/config/states/maas
index 710ec0e82..db0bd3fe6 100755
--- a/mcp/config/states/maas
+++ b/mcp/config/states/maas
@@ -3,10 +3,12 @@ set -x
 
 function wait_for() {
   local total_attempts=$1; shift
-  local cmdstr=$@
+  local cmdstr=$*
   local sleep_time=10
   echo "[NOTE] Waiting for cmd to return success: ${cmdstr}"
+  # shellcheck disable=SC2034
   for attempt in $(seq "${total_attempts}"); do
+    # shellcheck disable=SC2015
     eval "${cmdstr}" && break || true
     echo -n '.'; sleep "${sleep_time}"
   done
@@ -17,8 +19,10 @@ function maas_fixup() {
   local statuscmd="salt 'mas01*' --out yaml state.apply maas.machines.status"
   wait_for 180 "${statuscmd} | tee /dev/stderr | " \
            "grep -Eq '((Deployed|Ready): 5|status:Failed|status:Allocated)'"
+  # shellcheck disable=SC2155
   local statusout=$(eval "${statuscmd}")
 
+  # shellcheck disable=SC2155
   local fcnodes=$(echo "${statusout}" | \
     grep -Po '(?<=system_id:)(.*)(?=,status:Failed commissioning)')
   for node_system_id in ${fcnodes}; do
@@ -30,6 +34,7 @@ function maas_fixup() {
     return 1
   fi
 
+  # shellcheck disable=SC2155
   local fdnodes=$(echo "${statusout}" | \
     grep -Po '(?<=system_id:)(.*)(?=,status:(Failed deployment|Allocated))')
   for node_system_id in ${fdnodes}; do
@@ -106,4 +111,4 @@ wait_for 10 "! salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply linux,ntp |
   "tee /dev/stderr | fgrep -q 'Not connected'"
 
 wait_for 10 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' ssh.set_auth_key ${SUDO_USER} \
-  $(awk 'NR==1{print $2}' $(eval echo ~${SUDO_USER}/.ssh/authorized_keys))"
+  $(awk 'NR==1{print $2}' "$(eval echo "~${SUDO_USER}/.ssh/authorized_keys")")"
-- 
cgit