summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/data/opt/openslx/vmchooser
diff options
context:
space:
mode:
authorSimon Rettberg2023-06-02 16:57:46 +0200
committerSimon Rettberg2023-06-02 16:57:46 +0200
commit84dbb5bebae410099eb54bbd84ce3e8b2e715edf (patch)
treeb40696e77facd938dd3a9502a71853be83095891 /core/modules/run-virt/data/opt/openslx/vmchooser
parent[run-virt] Log which download method was used (diff)
downloadmltk-84dbb5bebae410099eb54bbd84ce3e8b2e715edf.tar.gz
mltk-84dbb5bebae410099eb54bbd84ce3e8b2e715edf.tar.xz
mltk-84dbb5bebae410099eb54bbd84ce3e8b2e715edf.zip
[run-virt] Add optional debug spam to safesource and friends
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser')
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
index a5c20aea..fe624ab5 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
@@ -289,8 +289,10 @@ safesource() {
fi
return 1
fi
- echo "eval source ${FILE} ;"
- echo "run_post_source ${FILE} ;"
+ echo "eval "
+ "$DEBUG" && echo "writelog 'Sourcing ${FILE}...' ;"
+ echo "source '${FILE}' ;"
+ echo "run_post_source '${FILE}' ;"
done
return 0
@@ -307,7 +309,8 @@ call_post_source() {
continue
fi
if notempty BASH_SOURCE[1]; then
- RUN_POST_SOURCE[${BASH_SOURCE[1]}]+="$1 "
+ RUN_POST_SOURCE["${BASH_SOURCE[1]}"]+="$1 "
+ "$DEBUG" && writelog "Added post-source call '$1' for '${BASH_SOURCE[1]}'"
shift
else
writelog "Could not determine the sourced file calling ${FUNCNAME[0]}"
@@ -318,16 +321,17 @@ call_post_source() {
# functions in the same order they were registered.
run_post_source() {
[ $# -ne 1 ] && writelog "'${FUNCNAME[0]}' expects one argument only! $# given." && return 1
+ local TASK RET
+ "$DEBUG" && writelog "Running post-source hooks for ${1}..."
for TASK in ${RUN_POST_SOURCE["${1}"]}; do
# sanity checks
if ! is_function "$TASK"; then
writelog "\tRegistered function '$TASK' is not a function!"
return 1 # TODO maybe even cleanexit here as this seems very bad...
fi
- # remove from stack before running it
- RUN_POST_SOURCE["${1}"]="${RUN_POST_SOURCE[${1//${TASK}\ /\ }]}"
+ "$DEBUG" && writelog " - ${TASK}"
"${TASK}"
- local -i RET=$?
+ RET=$?
if [ "$RET" -ne 0 ]; then
writelog "\tFailed to run post source '${TASK}' (Exit code: $RET)"
return "$RET"