Skip to content

Commit 7850359

Browse files
authored
Merge pull request #17577 from hakman/simplify-nodeup-template
nodeup: Simplify the template by removing split-commas
2 parents 633a9b7 + b058094 commit 7850359

File tree

184 files changed

+184
-920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+184
-920
lines changed

pkg/model/resources/nodeup.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ download-or-bust() {
7474
local -r file="$1"
7575
local -r hash="$2"
7676
local -a urls
77-
mapfile -t urls < <(split-commas "$3")
77+
IFS=, read -r -a urls <<< "$3"
7878
7979
if [[ -f "${file}" ]]; then
8080
if ! validate-hash "${file}" "${hash}"; then
@@ -125,10 +125,6 @@ validate-hash() {
125125
fi
126126
}
127127
128-
function split-commas() {
129-
echo "$1" | tr "," "\n"
130-
}
131-
132128
function download-release() {
133129
case "$(uname -m)" in
134130
x86_64*|i?86_64*|amd64*)

pkg/model/tests/data/bootstrapscript_0.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ download-or-bust() {
5252
local -r file="$1"
5353
local -r hash="$2"
5454
local -a urls
55-
mapfile -t urls < <(split-commas "$3")
55+
IFS=, read -r -a urls <<< "$3"
5656

5757
if [[ -f "${file}" ]]; then
5858
if ! validate-hash "${file}" "${hash}"; then
@@ -103,10 +103,6 @@ validate-hash() {
103103
fi
104104
}
105105

106-
function split-commas() {
107-
echo "$1" | tr "," "\n"
108-
}
109-
110106
function download-release() {
111107
case "$(uname -m)" in
112108
x86_64*|i?86_64*|amd64*)

pkg/model/tests/data/bootstrapscript_1.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ download-or-bust() {
5252
local -r file="$1"
5353
local -r hash="$2"
5454
local -a urls
55-
mapfile -t urls < <(split-commas "$3")
55+
IFS=, read -r -a urls <<< "$3"
5656

5757
if [[ -f "${file}" ]]; then
5858
if ! validate-hash "${file}" "${hash}"; then
@@ -103,10 +103,6 @@ validate-hash() {
103103
fi
104104
}
105105

106-
function split-commas() {
107-
echo "$1" | tr "," "\n"
108-
}
109-
110106
function download-release() {
111107
case "$(uname -m)" in
112108
x86_64*|i?86_64*|amd64*)

pkg/model/tests/data/bootstrapscript_2.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ download-or-bust() {
5252
local -r file="$1"
5353
local -r hash="$2"
5454
local -a urls
55-
mapfile -t urls < <(split-commas "$3")
55+
IFS=, read -r -a urls <<< "$3"
5656

5757
if [[ -f "${file}" ]]; then
5858
if ! validate-hash "${file}" "${hash}"; then
@@ -103,10 +103,6 @@ validate-hash() {
103103
fi
104104
}
105105

106-
function split-commas() {
107-
echo "$1" | tr "," "\n"
108-
}
109-
110106
function download-release() {
111107
case "$(uname -m)" in
112108
x86_64*|i?86_64*|amd64*)

pkg/model/tests/data/bootstrapscript_3.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ download-or-bust() {
5252
local -r file="$1"
5353
local -r hash="$2"
5454
local -a urls
55-
mapfile -t urls < <(split-commas "$3")
55+
IFS=, read -r -a urls <<< "$3"
5656

5757
if [[ -f "${file}" ]]; then
5858
if ! validate-hash "${file}" "${hash}"; then
@@ -103,10 +103,6 @@ validate-hash() {
103103
fi
104104
}
105105

106-
function split-commas() {
107-
echo "$1" | tr "," "\n"
108-
}
109-
110106
function download-release() {
111107
case "$(uname -m)" in
112108
x86_64*|i?86_64*|amd64*)

pkg/model/tests/data/bootstrapscript_4.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ download-or-bust() {
5252
local -r file="$1"
5353
local -r hash="$2"
5454
local -a urls
55-
mapfile -t urls < <(split-commas "$3")
55+
IFS=, read -r -a urls <<< "$3"
5656

5757
if [[ -f "${file}" ]]; then
5858
if ! validate-hash "${file}" "${hash}"; then
@@ -103,10 +103,6 @@ validate-hash() {
103103
fi
104104
}
105105

106-
function split-commas() {
107-
echo "$1" | tr "," "\n"
108-
}
109-
110106
function download-release() {
111107
case "$(uname -m)" in
112108
x86_64*|i?86_64*|amd64*)

pkg/model/tests/data/bootstrapscript_5.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ download-or-bust() {
5252
local -r file="$1"
5353
local -r hash="$2"
5454
local -a urls
55-
mapfile -t urls < <(split-commas "$3")
55+
IFS=, read -r -a urls <<< "$3"
5656

5757
if [[ -f "${file}" ]]; then
5858
if ! validate-hash "${file}" "${hash}"; then
@@ -103,10 +103,6 @@ validate-hash() {
103103
fi
104104
}
105105

106-
function split-commas() {
107-
echo "$1" | tr "," "\n"
108-
}
109-
110106
function download-release() {
111107
case "$(uname -m)" in
112108
x86_64*|i?86_64*|amd64*)

tests/integration/update_cluster/additionalobjects/data/aws_launch_template_master-us-test-1a.masters.additionalobjects.example.com_user_data

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ download-or-bust() {
3636
local -r file="$1"
3737
local -r hash="$2"
3838
local -a urls
39-
mapfile -t urls < <(split-commas "$3")
39+
IFS=, read -r -a urls <<< "$3"
4040

4141
if [[ -f "${file}" ]]; then
4242
if ! validate-hash "${file}" "${hash}"; then
@@ -87,10 +87,6 @@ validate-hash() {
8787
fi
8888
}
8989

90-
function split-commas() {
91-
echo "$1" | tr "," "\n"
92-
}
93-
9490
function download-release() {
9591
case "$(uname -m)" in
9692
x86_64*|i?86_64*|amd64*)

tests/integration/update_cluster/additionalobjects/data/aws_launch_template_nodes.additionalobjects.example.com_user_data

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ download-or-bust() {
3636
local -r file="$1"
3737
local -r hash="$2"
3838
local -a urls
39-
mapfile -t urls < <(split-commas "$3")
39+
IFS=, read -r -a urls <<< "$3"
4040

4141
if [[ -f "${file}" ]]; then
4242
if ! validate-hash "${file}" "${hash}"; then
@@ -87,10 +87,6 @@ validate-hash() {
8787
fi
8888
}
8989

90-
function split-commas() {
91-
echo "$1" | tr "," "\n"
92-
}
93-
9490
function download-release() {
9591
case "$(uname -m)" in
9692
x86_64*|i?86_64*|amd64*)

tests/integration/update_cluster/apiservernodes/data/aws_launch_template_apiserver.apiservers.minimal.example.com_user_data

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ download-or-bust() {
3636
local -r file="$1"
3737
local -r hash="$2"
3838
local -a urls
39-
mapfile -t urls < <(split-commas "$3")
39+
IFS=, read -r -a urls <<< "$3"
4040

4141
if [[ -f "${file}" ]]; then
4242
if ! validate-hash "${file}" "${hash}"; then
@@ -87,10 +87,6 @@ validate-hash() {
8787
fi
8888
}
8989

90-
function split-commas() {
91-
echo "$1" | tr "," "\n"
92-
}
93-
9490
function download-release() {
9591
case "$(uname -m)" in
9692
x86_64*|i?86_64*|amd64*)

0 commit comments

Comments
 (0)