2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00

utilities/bashcomp: Do not run ovs-vsctl when not possible.

Bash command completion setup is done during login process. If a command
is not available, but it is tried to be run, there is then inconvenient
error messages at each login.

Signed-off-by: Markus Linnala <markus.linnala@gmail.com>
Signed-off-by: Simon Horman <horms@ovn.org>
This commit is contained in:
Markus Linnala 2025-01-19 16:37:15 +02:00 committed by Simon Horman
parent 2472845c39
commit ec8fe88d73

View File

@ -32,11 +32,15 @@ _ovs_vsctl () {
# A bar (|) character in an argument means thing before bar OR thing
# after bar; for example, del-port can take a port or an interface.
_OVS_VSCTL_COMMANDS="$(_ovs_vsctl --commands)"
_OVS_VSCTL_COMMANDS=
_OVS_VSCTL_OPTIONS=
if command -v ovs-vsctl > /dev/null; then
_OVS_VSCTL_COMMANDS="$(_ovs_vsctl --commands)"
# This doesn't complete on short arguments, so it filters them out.
_OVS_VSCTL_OPTIONS="$(_ovs_vsctl --options | awk '/^--/ { print $0 }' \
| sed -e 's/\(.*\)=ARG/\1=/')"
# This doesn't complete on short arguments, so it filters them out.
_OVS_VSCTL_OPTIONS="$(_ovs_vsctl --options | awk '/^--/ { print $0 }' \
| sed -e 's/\(.*\)=ARG/\1=/')"
fi
IFS=$SAVE_IFS
declare -A _OVS_VSCTL_PARSED_ARGS