Fix issue where a filter matches one item exactly and others partially.
This commit is contained in:
parent
5bebd3f86e
commit
9e14f38735
29
gnscli.sh
29
gnscli.sh
|
@ -2349,6 +2349,7 @@ function validate_action_obs() { # infoname whattolist actionfilter showerroropt
|
|||
local infoname whattolist actionfilter showerroropt
|
||||
local selobname="" selobuuid=""
|
||||
local retvar_obname retvar_obuuid multiallowed
|
||||
local gotexactmatch=0
|
||||
infoname="$1"
|
||||
whattolist="$2"
|
||||
actionfilter="$3"
|
||||
|
@ -2394,11 +2395,35 @@ debug "alluuids is $alluuids"
|
|||
o_arr=($allobs)
|
||||
ou_arr=($alluuids)
|
||||
|
||||
|
||||
if [[ $nobs -gt 1 && $multiallowed -eq 0 ]]; then
|
||||
debug "actionfilter=$actionfilter"
|
||||
if [[ -n $actionfilter ]]; then
|
||||
local x
|
||||
# do any of them match exactly?
|
||||
for x in ${!o_arr[@]}; do
|
||||
if [[ "-f${o_arr[$x]}" == $actionfilter ]]; then
|
||||
selobname="${o_arr[$x]}"
|
||||
selobuuid="${ou_arr[$x]}"
|
||||
unset o_arr
|
||||
unset ou_arr
|
||||
o_arr=($selobname)
|
||||
ou_arr=($selobuuid)
|
||||
allobs="$selobname"
|
||||
alluuids="$selobuuid"
|
||||
nobs=1
|
||||
nuuids=1
|
||||
|
||||
inform "'${INFORMCOLB}${actionfilter}${INFORMCOL}' matched multiple ${whattolist}s"
|
||||
narrowdown "$whattolist" "$allobs" "$alluuids" selobname selobuuid || rv=1
|
||||
gotexactmatch=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $gotexactmatch -ne 1 ]]; then
|
||||
|
||||
inform "'${INFORMCOLB}${actionfilter:2}${INFORMCOL}' matched multiple ${whattolist}s"
|
||||
narrowdown "$whattolist" "$allobs" "$alluuids" selobname selobuuid || rv=1
|
||||
fi
|
||||
else
|
||||
selobname="$allobs"
|
||||
selobuuid="$alluuids"
|
||||
|
|
Loading…
Reference in New Issue