Commit e7cbe965 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add code to make task exclusion possible

parent a5dbdff8
......@@ -159,8 +159,22 @@ cleanup() {
fi
}
trap cleanup EXIT
check_if_excluded() {
trap cleanup EXIT
test "$PROGNAME" = "snf-image-helper" && return 0
eval local do_exclude=\$SNF_IMAGE_EXCLUDE_${PROGNAME:2}_TASK
if [ -n "$do_exclude" ]; then
warn "Task $PROGNAME was excluded and will not run."
exit 0
fi
return 0
}
# Check if the execution of a task should be ommited
check_if_excluded
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
......@@ -79,13 +79,15 @@ fi
# in case it is left mounted...
trap '{ umount "$target"; }' ERR
# Redirect standard error to standard output,
# prepend a timestamp before each line of output.
echo "Execute all snf-image tasks...."
$RUN_PARTS -v --exit-on-error "@tasksdir@" 2>&1|
while IFS= read -r line; do
echo $(date +%Y:%m:%d-%H:%M:%S.%N) "$line"
done
if [ -z "$SNF_IMAGE_EXCLUDE_ALL_TASKS" ]; then
# Redirect standard error to standard output,
# prepend a timestamp before each line of output.
echo "Execute all snf-image tasks...."
$RUN_PARTS -v --exit-on-error "@tasksdir@" 2>&1|
while IFS= read -r line; do
echo $(date +%Y:%m:%d-%H:%M:%S.%N) "$line"
done
fi
# Disable the trap. If code reaches here, the filesystem is unmounted.
trap - ERR
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment