diff --git a/pkg/model/resources/nodeup.go b/pkg/model/resources/nodeup.go index 1485bd88f3..086db078b5 100644 --- a/pkg/model/resources/nodeup.go +++ b/pkg/model/resources/nodeup.go @@ -74,9 +74,10 @@ download-or-bust() { while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -93,6 +94,7 @@ download-or-bust() { if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/pkg/model/tests/data/bootstrapscript_0.txt b/pkg/model/tests/data/bootstrapscript_0.txt index 0cde801f4c..4819e5f5bc 100644 --- a/pkg/model/tests/data/bootstrapscript_0.txt +++ b/pkg/model/tests/data/bootstrapscript_0.txt @@ -63,9 +63,10 @@ download-or-bust() { while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -82,6 +83,7 @@ download-or-bust() { if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/pkg/model/tests/data/bootstrapscript_1.txt b/pkg/model/tests/data/bootstrapscript_1.txt index ee92c3c482..3c3cd423df 100644 --- a/pkg/model/tests/data/bootstrapscript_1.txt +++ b/pkg/model/tests/data/bootstrapscript_1.txt @@ -63,9 +63,10 @@ download-or-bust() { while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -82,6 +83,7 @@ download-or-bust() { if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/pkg/model/tests/data/bootstrapscript_2.txt b/pkg/model/tests/data/bootstrapscript_2.txt index ee92c3c482..3c3cd423df 100644 --- a/pkg/model/tests/data/bootstrapscript_2.txt +++ b/pkg/model/tests/data/bootstrapscript_2.txt @@ -63,9 +63,10 @@ download-or-bust() { while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -82,6 +83,7 @@ download-or-bust() { if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/pkg/model/tests/data/bootstrapscript_3.txt b/pkg/model/tests/data/bootstrapscript_3.txt index 88639f1a2e..b77d064ec5 100644 --- a/pkg/model/tests/data/bootstrapscript_3.txt +++ b/pkg/model/tests/data/bootstrapscript_3.txt @@ -63,9 +63,10 @@ download-or-bust() { while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -82,6 +83,7 @@ download-or-bust() { if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/pkg/model/tests/data/bootstrapscript_4.txt b/pkg/model/tests/data/bootstrapscript_4.txt index 986fea620d..6dbda1be3b 100644 --- a/pkg/model/tests/data/bootstrapscript_4.txt +++ b/pkg/model/tests/data/bootstrapscript_4.txt @@ -63,9 +63,10 @@ download-or-bust() { while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -82,6 +83,7 @@ download-or-bust() { if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/pkg/model/tests/data/bootstrapscript_5.txt b/pkg/model/tests/data/bootstrapscript_5.txt index 986fea620d..6dbda1be3b 100644 --- a/pkg/model/tests/data/bootstrapscript_5.txt +++ b/pkg/model/tests/data/bootstrapscript_5.txt @@ -63,9 +63,10 @@ download-or-bust() { while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -82,6 +83,7 @@ download-or-bust() { if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/tests/integration/update_cluster/additional_cidr/cloudformation.json.extracted.yaml b/tests/integration/update_cluster/additional_cidr/cloudformation.json.extracted.yaml index dff219a652..d2b3837398 100644 --- a/tests/integration/update_cluster/additional_cidr/cloudformation.json.extracted.yaml +++ b/tests/integration/update_cluster/additional_cidr/cloudformation.json.extracted.yaml @@ -48,9 +48,10 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1bmastersadditionalcidrex while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -67,6 +68,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1bmastersadditionalcidrex if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" @@ -324,9 +326,10 @@ Resources.AWSAutoScalingLaunchConfigurationnodesadditionalcidrexamplecom.Propert while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -343,6 +346,7 @@ Resources.AWSAutoScalingLaunchConfigurationnodesadditionalcidrexamplecom.Propert if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/tests/integration/update_cluster/additional_user-data/cloudformation.json.extracted.yaml b/tests/integration/update_cluster/additional_user-data/cloudformation.json.extracted.yaml index 1b46cfcdc3..6213d23dec 100644 --- a/tests/integration/update_cluster/additional_user-data/cloudformation.json.extracted.yaml +++ b/tests/integration/update_cluster/additional_user-data/cloudformation.json.extracted.yaml @@ -57,9 +57,10 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersadditionaluserda while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -76,6 +77,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersadditionaluserda if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" @@ -354,9 +356,10 @@ Resources.AWSAutoScalingLaunchConfigurationnodesadditionaluserdataexamplecom.Pro while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -373,6 +376,7 @@ Resources.AWSAutoScalingLaunchConfigurationnodesadditionaluserdataexamplecom.Pro if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/tests/integration/update_cluster/existing_iam_cloudformation/cloudformation.json.extracted.yaml b/tests/integration/update_cluster/existing_iam_cloudformation/cloudformation.json.extracted.yaml index 38fa31c4f2..a9af2afe75 100644 --- a/tests/integration/update_cluster/existing_iam_cloudformation/cloudformation.json.extracted.yaml +++ b/tests/integration/update_cluster/existing_iam_cloudformation/cloudformation.json.extracted.yaml @@ -48,9 +48,10 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -67,6 +68,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" @@ -324,9 +326,10 @@ Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.Use while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -343,6 +346,7 @@ Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.Use if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" diff --git a/tests/integration/update_cluster/minimal-cloudformation/cloudformation.json.extracted.yaml b/tests/integration/update_cluster/minimal-cloudformation/cloudformation.json.extracted.yaml index 38fa31c4f2..a9af2afe75 100644 --- a/tests/integration/update_cluster/minimal-cloudformation/cloudformation.json.extracted.yaml +++ b/tests/integration/update_cluster/minimal-cloudformation/cloudformation.json.extracted.yaml @@ -48,9 +48,10 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -67,6 +68,7 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) ==" @@ -324,9 +326,10 @@ Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.Use while true; do for url in "${urls[@]}"; do local file="${url##*/}" - rm -f "${file}" - if [[ $(which curl) ]]; then + if [[ -e "${file}" ]]; then + echo "== File exists for ${url} ==" + elif [[ $(which curl) ]]; then if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then echo "== Failed to curl ${url}. Retrying. ==" break @@ -343,6 +346,7 @@ Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.Use if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then echo "== Hash validation of ${url} failed. Retrying. ==" + rm -f "${file}" else if [[ -n "${hash}" ]]; then echo "== Downloaded ${url} (SHA1 = ${hash}) =="