Commit cfe3c3b8 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch '50-extra-response-string-when-evaluation-url' into 'master'

fix(url): Resolve "extra response string when evaluation @url@"

Closes #50

See merge request to-be-continuous/terraform!83
parents a90fa5d4 02a70960
Loading
Loading
Loading
Loading
+20 −13
Original line number Diff line number Diff line
@@ -290,9 +290,15 @@ stages:
      protocol=$(echo "$url" | cut -d':' -f1)
      if command -v busybox > /dev/null && [ "${protocol}" == "http" ]
      then
        output=$(mktemp)
        decoded=$(mktemp)
        errors=$(mktemp)
        if wget -T 5 -O "${decoded}" "$url" 2> "${errors}"
        then
          # shellcheck disable=SC2086
          export ${name}="$(cat ${decoded})"
          log_info "Successfully wget'd secret \\e[33;1m${name}\\e[0m"
        else
          output=$(mktemp)
          host_port=$(echo "$url" | cut -d'/' -f3)
          host=$(echo "$host_port" | cut -d':' -f1)
          port=$(echo "$host_port" | cut -d':' -s -f2)
@@ -309,6 +315,7 @@ stages:
          else
            log_warn "Failed getting secret \\e[33;1m${name}\\e[0m (${status_code} ${status_message}):\\n$(sed 's/^/... /g' "${decoded}")\\n... -----\\n$(sed 's/^/... /g' "${errors}")"
          fi
        fi
      elif command -v curl > /dev/null
      then
        decoded=$(mktemp)