prerequisite: fix old bash complains "delcare -A"
Longhorn 5738 Signed-off-by: Derek Su <derek.su@suse.com>
This commit is contained in:
parent
b15eac47a6
commit
9c7cfd7a53
@ -233,11 +233,13 @@ check_mount_propagation() {
|
|||||||
check_hostname_uniqueness() {
|
check_hostname_uniqueness() {
|
||||||
hostnames=$(kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="Hostname")].address}')
|
hostnames=$(kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="Hostname")].address}')
|
||||||
|
|
||||||
declare -A deduplicate_hostnames
|
deduplicate_hostnames=()
|
||||||
num_nodes=0
|
num_nodes=0
|
||||||
for hostname in ${hostnames}; do
|
for hostname in ${hostnames}; do
|
||||||
num_nodes=$((num_nodes+1))
|
num_nodes=$((num_nodes+1))
|
||||||
deduplicate_hostnames["${hostname}"]="${hostname}"
|
if ! echo "${deduplicate_hostnames[@]}" | grep -q "\<${hostname}\>"; then
|
||||||
|
deduplicate_hostnames+=("${hostname}")
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${#deduplicate_hostnames[@]}" != "${num_nodes}" ]; then
|
if [ "${#deduplicate_hostnames[@]}" != "${num_nodes}" ]; then
|
||||||
@ -245,7 +247,7 @@ check_hostname_uniqueness() {
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Hostname uniqueness check is passed."
|
info "All nodes have unique hostnames."
|
||||||
}
|
}
|
||||||
|
|
||||||
check_nodes() {
|
check_nodes() {
|
||||||
|
Loading…
Reference in New Issue
Block a user