Unverified Commit c5234594 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #55682 from porridge/unset-array

Automatic merge from submit-queue (batch tested with PRs 55682, 55444, 55456, 55717, 55131). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Do not crash on empty NODE_NAMES array. **Which issue(s) this PR fixes**: Fixes #55675 **Release note**: ```release-note NONE ```
parents d6325933 310ab8c3
...@@ -219,7 +219,7 @@ function dump_masters() { ...@@ -219,7 +219,7 @@ function dump_masters() {
} }
function dump_nodes() { function dump_nodes() {
local node_names local node_names=()
if [[ -n "${1:-}" ]]; then if [[ -n "${1:-}" ]]; then
echo "Dumping logs for nodes provided as args to dump_nodes() function" echo "Dumping logs for nodes provided as args to dump_nodes() function"
node_names=( "$@" ) node_names=( "$@" )
...@@ -232,7 +232,9 @@ function dump_nodes() { ...@@ -232,7 +232,9 @@ function dump_nodes() {
else else
echo "Detecting nodes in the cluster" echo "Detecting nodes in the cluster"
detect-node-names &> /dev/null detect-node-names &> /dev/null
node_names=( "${NODE_NAMES[@]}" ) if [[ -n "${NODE_NAMES:-}" ]]; then
node_names=( "${NODE_NAMES[@]}" )
fi
fi fi
if [[ "${#node_names[@]}" == 0 ]]; then if [[ "${#node_names[@]}" == 0 ]]; then
...@@ -283,7 +285,7 @@ function dump_nodes_with_logexporter() { ...@@ -283,7 +285,7 @@ function dump_nodes_with_logexporter() {
echo "Detecting nodes in the cluster" echo "Detecting nodes in the cluster"
detect-node-names &> /dev/null detect-node-names &> /dev/null
if [[ "${#NODE_NAMES[@]}" == 0 ]]; then if [[ -z "${NODE_NAMES:-}" ]]; then
echo "No nodes found!" echo "No nodes found!"
return return
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment