-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parse error for multiple OPTIONS to run node #17212
Fix parse error for multiple OPTIONS to run node #17212
Conversation
@Miciah mind validating this bash change? |
/assign miciah |
/retest |
@@ -8,4 +8,4 @@ if [ "$#" -ne 0 ]; then | |||
opts="" | |||
fi | |||
|
|||
exec /usr/bin/openshift start node "--config=${conf}" "${opts}" $@ | |||
exec /usr/bin/openshift start node "--config=${conf}" ${opts} $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine if we do not need to support values with whitespace.
/lgtm
However, if we do want to support values with whitespace (e.g., OPTIONS=--foo='bar baz' --foo=bar\ baz --foo="bar baz"
), we need to do something a little fancier. The following uses eval
to perform shell word splitting on the value of OPTIONS
:
eval "opts=( ${OPTIONS:---loglevel=2} )"
if [[ "$#" -ne 0 ]]; then
opts=( "$@" )
fi
exec /usr/bin/openshift start node "--config=${conf}" "${opts[@]}"
Alternatively, the following is simpler in my opinion (but use your own judgment):
if [[ "$#" -eq 0 ]]; then
eval "set -- ${OPTIONS:---loglevel=2}"
fi
exec /usr/bin/openshift start node "--config=${conf}" "$@"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am quite sure that OpenShfit/k8s will not support whitespace options like OPTIONS=--foo='bar baz'
. However, it is not 0%, and also I don't want to overlook @Miciah's excellent idea, so updated the PR with his second option.
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Miciah, nak3, sdodson The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
@nak3: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Automatic merge from submit-queue. |
/cherrypick release-3.8 |
@sdodson: #17212 failed to apply on top of branch "release-3.8":
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
bash env variables put single quotation (
''
) when the variable has""
. Due to this and behavior of golang's parse mechanism,containerized OpenShift Node cannot start if OPTIONS contains multiple
variables.
This patch removes the double quotations from the start script of
OpenShift Node.
You can simulate the issue with following steps:
/usr/local/bin/origin-node-run.sh
oropenshift start node '--loglevel=3 --disable=proxy'