Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions scripts/kata-install/osc-kata-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ main() {
exit 1
}

[[ -z "${NODE_LABEL:-}" ]] && {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of :- here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -u option is set, so if the variable is unset, it results in an error. Therefore, we don’t necessarily need :-, but using it allows us to set the variable to an empty string and thereby control the error message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant: You are adding a test to check if NODE_LABEL is not set, with an error message that essentially is a almost exactly what bash itself would give you.

I see no functional difference between

ERROR: NODE_LABEL env var must be set

and

NODEL_LABEL: unbound variable

So that code segment seems pointless to me.

Alternative: make the error message better, and send it to stderr instead of stdout.

echo "ERROR: NODE_LABEL env var must be set."
exit 1
}

#[[ -z "${LOG_LEVEL}" ]] || {
# echo "ERROR: LOG_LEVEL env var must be set."
# exit 1
Expand Down