Merge "MaaS: commissioning/deployment retry"
authorMichael Polenchuk <mpolenchuk@mirantis.com>
Thu, 24 Aug 2017 06:07:24 +0000 (06:07 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Thu, 24 Aug 2017 06:07:24 +0000 (06:07 +0000)
1  2 
mcp/config/states/maas

@@@ -1,16 -1,12 +1,14 @@@
  #!/bin/bash
 +set -x
 +
  function wait_for() {
+   local total_attempts=$1; shift
    local cmdstr=$@
-   local total_attempts=360
    local sleep_time=10
-   local attempt=1
    echo "[NOTE] Waiting for cmd to return success: ${cmdstr}"
-   while ((attempt <= total_attempts)); do
+   for attempt in $(seq "${total_attempts}"); do
      eval "${cmdstr}" && break || true
      echo -n '.'; sleep "${sleep_time}"
-     ((attempt+=1))
    done
  }