deploy: support des options -old pour afficher des informations supplémentaires
This commit is contained in:
parent
2daf190c60
commit
c1a536be52
|
@ -30,14 +30,17 @@ function deploy_query_recursive() {
|
||||||
|
|
||||||
function deploy_query_once() {
|
function deploy_query_once() {
|
||||||
# Afficher le résultat d'une requête
|
# Afficher le résultat d'une requête
|
||||||
local alv
|
local alv sov slv sdv
|
||||||
eval "set -- $(getopt -ov: -lallow-vars: -- "$@")"
|
eval "set -- $(getopt -ov:old -lallow-vars:,object-vars,link-vars,dest-vars -- "$@")"
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-v|--allow-vars)
|
-v|--allow-vars)
|
||||||
array_split alv "$2" ,
|
array_split alv "$2" ,
|
||||||
shift; shift
|
shift; shift
|
||||||
;;
|
;;
|
||||||
|
-o|--object-vars) sov=1; shift;;
|
||||||
|
-l|--link-vars) slv=1; shift;;
|
||||||
|
-d|--dest-vars) sdv=1; shift;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
*) break;;
|
*) break;;
|
||||||
esac
|
esac
|
||||||
|
@ -50,7 +53,7 @@ function deploy_query_once() {
|
||||||
DEST|SOURCE)
|
DEST|SOURCE)
|
||||||
if [ -n "$otype" ]; then
|
if [ -n "$otype" ]; then
|
||||||
deploy_is_type "$otype" || {
|
deploy_is_type "$otype" || {
|
||||||
qvals false "$otype: invalid type"
|
[ "$format" == shell ] && qvals false "$otype: invalid type"
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
@ -58,7 +61,7 @@ function deploy_query_once() {
|
||||||
*)
|
*)
|
||||||
if [ -n "$qtype" ]; then
|
if [ -n "$qtype" ]; then
|
||||||
deploy_is_type "$qtype" || {
|
deploy_is_type "$qtype" || {
|
||||||
qvals false "$qtype: invalid type"
|
[ "$format" == shell ] && qvals false "$qtype: invalid type"
|
||||||
return 3
|
return 3
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
@ -66,12 +69,12 @@ function deploy_query_once() {
|
||||||
esac
|
esac
|
||||||
if [ -n "$ltype" ]; then
|
if [ -n "$ltype" ]; then
|
||||||
deploy_is_link "$ltype" || {
|
deploy_is_link "$ltype" || {
|
||||||
qvals false "$ltype: invalid link type"
|
[ "$format" == shell ] && qvals false "$ltype: invalid link type"
|
||||||
return 4
|
return 4
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
[ -n "$term" ] || {
|
[ -n "$term" ] || {
|
||||||
qvals false "search term required"
|
[ "$format" == shell ] && qvals false "search term required"
|
||||||
return 5
|
return 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,25 +83,40 @@ function deploy_query_once() {
|
||||||
edebug "=== search type DEST"
|
edebug "=== search type DEST"
|
||||||
edebug "term=$term, otype=$otype"
|
edebug "term=$term, otype=$otype"
|
||||||
deploy_search_artifact object type "$term" "$otype" host || {
|
deploy_search_artifact object type "$term" "$otype" host || {
|
||||||
qvals false "artifact not found"
|
[ "$format" == shell ] && qvals false "artifact not found"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
edebug "object=$object, type=$type"
|
edebug "object=$object, type=$type"
|
||||||
deploy_search_link link "$type" "$ltype" || {
|
deploy_search_link link "$type" "$ltype" || {
|
||||||
qvals false "link not found"
|
[ "$format" == shell ] && qvals false "link not found"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy_show_values object object "$format" shell alv
|
deploy_show_values object object "$format" shell alv
|
||||||
deploy_show_values type otype "$format" shell alv
|
deploy_show_values type otype "$format" shell alv
|
||||||
deploy_show_values link ltype "$format" shell alv
|
deploy_show_values link ltype "$format" shell alv
|
||||||
deploy_show_links "$object" "$link" "$profile" "$format" "" alv
|
if [ -n "$sov" ]; then
|
||||||
echo true
|
deploy_copy_object_values vs "$object" "$type"
|
||||||
|
deploy_show_values vs "$type" "$format" shell alv
|
||||||
|
deploy_show_attrs "$object" "$type" "$format" alv vars
|
||||||
|
fi
|
||||||
|
if [ -n "$sdv" ]; then
|
||||||
|
local -a pons pgns ons gns ans ovs os; local an av o
|
||||||
|
deploy_prepare_copy_link_attrs pons pgns ons gns "$object" "$link" "$profile"
|
||||||
|
deploy_copy_link_attr_values hvs host "$object" "$link" "$profile" pons pgns ons gns
|
||||||
|
for hv in "${hvs[@]}"; do
|
||||||
|
deploy_copy_object_values hs "$hv" host
|
||||||
|
deploy_show_values hs host "$format" shell alv
|
||||||
|
deploy_show_attrs "$hn" host "$format" alv vars
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
deploy_show_links "$object" "$link" "$profile" "$format" "" alv vars
|
||||||
|
[ "$format" == shell ] && echo true
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
SOURCE)
|
SOURCE)
|
||||||
# XXX implémenter
|
# XXX implémenter
|
||||||
echo true
|
[ "$format" == shell ] && echo true
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -108,10 +126,10 @@ function deploy_query_once() {
|
||||||
deploy_show_values type otype "$format" shell alv
|
deploy_show_values type otype "$format" shell alv
|
||||||
deploy_show_values vs "$type" "$format" "" alv
|
deploy_show_values vs "$type" "$format" "" alv
|
||||||
deploy_show_attrs "$object" "$type" "$format" alv
|
deploy_show_attrs "$object" "$type" "$format" alv
|
||||||
echo true
|
[ "$format" == shell ] && echo true
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
qvals false "artifact not found"
|
[ "$format" == shell ] && qvals false "artifact not found"
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -250,10 +268,7 @@ function deploy_show_values() {
|
||||||
[ -n "$ff" -a "$f" != "$ff" ] && return
|
[ -n "$ff" -a "$f" != "$ff" ] && return
|
||||||
|
|
||||||
case "$f" in
|
case "$f" in
|
||||||
shell)
|
shell) deploy_dump_values "$t" vs;;
|
||||||
[ -n "$5" ] && echo "$t=()"
|
|
||||||
deploy_dump_values "$t" vs
|
|
||||||
;;
|
|
||||||
line) array_to_lines vs;;
|
line) array_to_lines vs;;
|
||||||
*) array_join vs "$f";;
|
*) array_join vs "$f";;
|
||||||
esac
|
esac
|
||||||
|
@ -270,12 +285,12 @@ function deploy_show_attrs() {
|
||||||
local -a ons gns ans vs; local an
|
local -a ons gns ans vs; local an
|
||||||
deploy_prepare_copy_attrs ons gns "$o" "$t"
|
deploy_prepare_copy_attrs ons gns "$o" "$t"
|
||||||
deploy_copy_attr_names ans "$o" "$t" ons gns
|
deploy_copy_attr_names ans "$o" "$t" ons gns
|
||||||
|
[ -n "$5" ] && echo_seta "${t}_vars" "${ans[@]}"
|
||||||
for an in "${ans[@]}"; do
|
for an in "${ans[@]}"; do
|
||||||
if [ -n "$4" ]; then
|
if [ -n "$4" ]; then
|
||||||
if ! array_isempty "$4"; then
|
if ! array_isempty "$4"; then
|
||||||
array_contains alv "$an" || continue
|
array_contains alv "$an" || continue
|
||||||
fi
|
fi
|
||||||
[ "$f" == shell ] && echo "$an=()"
|
|
||||||
fi
|
fi
|
||||||
deploy_copy_attr_values vs "$an" "$o" "$t" ons
|
deploy_copy_attr_values vs "$an" "$o" "$t" ons
|
||||||
deploy_dump_values "$an" vs
|
deploy_dump_values "$an" vs
|
||||||
|
@ -298,6 +313,7 @@ function deploy_show_links() {
|
||||||
|
|
||||||
deploy_prepare_copy_link_attrs pons pgns ons gns "$o" "$l" "$p"
|
deploy_prepare_copy_link_attrs pons pgns ons gns "$o" "$l" "$p"
|
||||||
deploy_copy_link_attr_names ans "$o" "$l" "$p" pons pgns ons gns
|
deploy_copy_link_attr_names ans "$o" "$l" "$p" pons pgns ons gns
|
||||||
|
[ -n "$7" -a "$f" == shell ] && echo_seta "${l}_vars" "${ans[@]}"
|
||||||
for an in "${ans[@]}"; do
|
for an in "${ans[@]}"; do
|
||||||
deploy_copy_link_attr_values avs "$an" "$o" "$l" "$p" pons pgns ons gns
|
deploy_copy_link_attr_values avs "$an" "$o" "$l" "$p" pons pgns ons gns
|
||||||
if [ "$an" == host ]; then
|
if [ "$an" == host ]; then
|
||||||
|
|
Loading…
Reference in New Issue