-
Notifications
You must be signed in to change notification settings - Fork 370
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
Stop using /bin/sh for OVS commands #5364
Stop using /bin/sh for OVS commands #5364
Conversation
We can probably remove usage of |
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.
LGTM
We are currently using the shell (/bin/sh) to run ovs-appctl and ovs-ofctl commands, but there does not seem to be a reason to do so. Instead, we can invoke the binary directly with exec.Command and pass the arguments as a slice. Before this change, ovsVSwitchdUDS would return "/var/run/openvswitch/ovs-vswitchd.*.ctl" as a fallback value in case the PID of ovs-vswitchd could not be determined. The shell would then expand the wildcard patterns. I now believe that it is better to return an error in that case. We want to make sure that we use a valid file always (and returning the glob pattern would cause an error if multiple files match). If we run into issues because of this approach, we can update the code to expand the glob pattern programmatically and, if a single path matches, we can return that path. Signed-off-by: Antonin Bas <[email protected]>
Signed-off-by: Antonin Bas <[email protected]>
f0cae62
to
9857700
Compare
/test-all |
@tnqn sorry I need a new approval, I had a typo in the |
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.
LGTM
…5374) We are currently using the shell (/bin/sh) to run ovs-appctl and ovs-ofctl commands, but there does not seem to be a reason to do so. Instead, we can invoke the binary directly with exec.Command and pass the arguments as a slice. Before this change, ovsVSwitchdUDS would return "/var/run/openvswitch/ovs-vswitchd.*.ctl" as a fallback value in case the PID of ovs-vswitchd could not be determined. The shell would then expand the wildcard patterns. I now believe that it is better to return an error in that case. We want to make sure that we use a valid file always (and returning the glob pattern would cause an error if multiple files match). If we run into issues because of this approach, we can update the code to expand the glob pattern programmatically and, if a single path matches, we can return that path. Signed-off-by: Antonin Bas <[email protected]>
…5372) We are currently using the shell (/bin/sh) to run ovs-appctl and ovs-ofctl commands, but there does not seem to be a reason to do so. Instead, we can invoke the binary directly with exec.Command and pass the arguments as a slice. Before this change, ovsVSwitchdUDS would return "/var/run/openvswitch/ovs-vswitchd.*.ctl" as a fallback value in case the PID of ovs-vswitchd could not be determined. The shell would then expand the wildcard patterns. I now believe that it is better to return an error in that case. We want to make sure that we use a valid file always (and returning the glob pattern would cause an error if multiple files match). If we run into issues because of this approach, we can update the code to expand the glob pattern programmatically and, if a single path matches, we can return that path. Signed-off-by: Antonin Bas <[email protected]>
…5373) We are currently using the shell (/bin/sh) to run ovs-appctl and ovs-ofctl commands, but there does not seem to be a reason to do so. Instead, we can invoke the binary directly with exec.Command and pass the arguments as a slice. Before this change, ovsVSwitchdUDS would return "/var/run/openvswitch/ovs-vswitchd.*.ctl" as a fallback value in case the PID of ovs-vswitchd could not be determined. The shell would then expand the wildcard patterns. I now believe that it is better to return an error in that case. We want to make sure that we use a valid file always (and returning the glob pattern would cause an error if multiple files match). If we run into issues because of this approach, we can update the code to expand the glob pattern programmatically and, if a single path matches, we can return that path. Signed-off-by: Antonin Bas <[email protected]>
We are currently using the shell (/bin/sh) to run ovs-appctl and ovs-ofctl commands, but there does not seem to be a reason to do so.
Instead, we can invoke the binary directly with exec.Command and pass the arguments as a slice.
Before this change, ovsVSwitchdUDS would return
"/var/run/openvswitch/ovs-vswitchd.*.ctl" as a fallback value in case the PID of ovs-vswitchd could not be determined. The shell would then expand the wildcard patterns. I now believe that it is better to return an error in that case. We want to make sure that we use a valid file always (and returning the glob pattern would cause an error if multiple files match). If we run into issues because of this approach, we can update the code to expand the glob pattern programmatically and, if a single path matches, we can return that path.