Skip to content

Commit

Permalink
utilities/bashcomp: Do not run ovs-vsctl when not possible.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
maage authored and Simon Horman committed Jan 28, 2025
1 parent 2472845 commit ec8fe88
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions utilities/ovs-vsctl-bashcomp.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

# 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=/')"
_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=/')"
fi
IFS=$SAVE_IFS

declare -A _OVS_VSCTL_PARSED_ARGS
Expand Down

0 comments on commit ec8fe88

Please sign in to comment.