added more debug traces to deboco

- deboco now forces the use of debops' --diff flag (provides useful information)
- now the executed debops command is visible in debg traces

work done while working on [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=4249]
This commit is contained in:
Guillaume Raffy 2025-12-18 14:33:11 +01:00
parent 9469a9f065
commit 366b0a327a
1 changed files with 13 additions and 6 deletions

View File

@ -471,7 +471,7 @@ deboco__init_machine()
return "$error_code"
}
common_update_machine()
apply_playbook_to_machine()
{
local debops_controller_path="$1"
local target_host_fqdn="$2" # eg alambix-108.ipr.univ-rennes.fr
@ -511,10 +511,14 @@ common_update_machine()
# example to apply just the role rsyslog:
if [ "$only_role" != '' ]
then
unbuffer debops run "${playbook}" --limit "${ANS_HOST:-/dev/null}" -t "${only_role}" | tee --append ${report_file_path}
log 'debug' "executing command: [unbuffer debops run "${playbook}" --limit "${ANS_HOST:-/dev/null}" -t "${only_role}" --diff | tee --append ${report_file_path}]..."
unbuffer debops run "${playbook}" --limit "${ANS_HOST:-/dev/null}" -t "${only_role}" --diff | tee --append ${report_file_path}
debops_exit_code=$?
else
unbuffer debops run "${playbook}" --limit "${ANS_HOST:-/dev/null}" | tee --append ${report_file_path}
log 'debug' "executing command: [unbuffer debops run "${playbook}" --limit "${ANS_HOST:-/dev/null}" --diff | tee --append ${report_file_path}]..."
unbuffer debops run "${playbook}" --limit "${ANS_HOST:-/dev/null}" --diff | tee --append ${report_file_path}
debops_exit_code=$?
fi
echo "return code for debops run site --limit ${ANS_HOST:-/dev/null} : $debops_exit_code" >> "${report_file_path}"
@ -537,7 +541,7 @@ deboco__update_machine()
local target_host_fqdn="$2" # eg alambix-108.ipr.univ-rennes.fr
local only_role=""
local playbook="site"
common_update_machine "$debops_controller_path" "$target_host_fqdn" "$only_role" "$playbook"
apply_playbook_to_machine "$debops_controller_path" "$target_host_fqdn" "$only_role" "$playbook"
}
deboco__update_machine_partially()
@ -550,7 +554,7 @@ deboco__update_machine_partially()
then
playbook='site'
fi
common_update_machine "$debops_controller_path" "$target_host_fqdn" "$only_role" "$playbook"
apply_playbook_to_machine "$debops_controller_path" "$target_host_fqdn" "$only_role" "$playbook"
}
deboco_print_usage()
@ -587,7 +591,10 @@ deboco_print_usage()
echo "examples:"
echo " deboco --python-path /usr/bin/python3.10 init ~/work/debops/controllers/alambix"
echo
echo "example to update xymon server's configuration (here it's much faster to specify the service apache than an unspecified service: 16s instead of 3m 33s):"
echo "example to update xymon server's configuration:"
echo " deboco update_machine_partially ~/debops/controllers/alambix monitoring.ipr.univ-rennes.fr role::xymon_server"
echo
echo "example to update xymon server's configuration after manually changing xymon server files(here it's much faster to specify the service apache than an unspecified service: 16s instead of 3m 33s):"
echo " deboco update_machine_partially ~/debops/controllers/alambix monitoring.ipr.univ-rennes.fr role::xymon_server service/apache"
echo
echo "example to update xymon client's configuration on alambix50 (the playbook that uses the role xymon (ie xymon client)) is currently ipr.post.debops):"