]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
build_utils: use custom playbook for collect_ceph_logs 2212/head
authorSeena Fallah <seenafallah@gmail.com>
Mon, 4 Mar 2024 12:31:11 +0000 (13:31 +0100)
committerSeena Fallah <seenafallah@gmail.com>
Mon, 4 Mar 2024 12:44:59 +0000 (13:44 +0100)
If provided, use the custom playbook to collect logs.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
ceph-ansible-prs/build/teardown
scripts/build_utils.sh

index edb86ad992893371e960f1ec0d70a50ca5e2b990..90548f8827b3015598171328792e53773a690569 100644 (file)
@@ -12,7 +12,8 @@ sudo journalctl -u libvirtd --pager-end --no-pager
 echo "======= END VAGRANT DEBUGGING ======="
 
 # the method exists in scripts/build_utils.sh
-teardown_vagrant_tests $VENV
+COLLECT_LOGS_PLAYBOOK_PATH="$WORKSPACE/tests/functional/collect-logs.yml"
+teardown_vagrant_tests $VENV $COLLECT_LOGS_PLAYBOOK_PATH
 
 # clean fact cache
 rm -rf $HOME/ansible/facts/*
index 5b2c16791e9347fb6df9236caec1db58c8765978..753005a7e05a09eac7395b465c1b7f08d7cd782c 100755 (executable)
@@ -1361,31 +1361,35 @@ EOF
 
 collect_ceph_logs() {
     local venv=$1
+    local limit=$2
+    local collect_logs_playbook_path=$3
     shift
     # this is meant to be run in a testing scenario directory
     # with running vagrant vms. the ansible playbook will connect
     # to your test nodes and fetch any ceph logs that are present
     # in /var/log/ceph and store them on the jenkins builder.
     # these logs can then be archived using the JJB archive publisher
-    limit=$1
 
     if [ -f "./vagrant_ssh_config" ]; then
         mkdir -p $WORKSPACE/logs
 
-        write_collect_logs_playbook
+        if [ -z "$collect_logs_playbook_path" ]; then
+            write_collect_logs_playbook
+            collect_logs_playbook_path="$WORKSPACE/collect-logs.yml"
+        fi
 
         pkgs=( "ansible" )
         install_python_packages $TEMPVENV "pkgs[@]"
 
         export ANSIBLE_SSH_ARGS='-F ./vagrant_ssh_config'
         export ANSIBLE_STDOUT_CALLBACK='debug'
-        $venv/ansible-playbook -vv -i hosts --limit $limit --extra-vars "archive_path=$WORKSPACE/logs" $WORKSPACE/collect-logs.yml || true
+        $venv/ansible-playbook -vv -i hosts --limit $limit --extra-vars "archive_path=$WORKSPACE/logs" "$collect_logs_playbook_path" || true
     fi
 }
 
 teardown_vagrant_tests() {
     local venv=$1
-    shift
+    local collect_logs_playbook_path=$2
 
     # collect ceph logs and teardown any running vagrant vms
     # this also cleans up any lingering livirt networks
@@ -1394,7 +1398,7 @@ teardown_vagrant_tests() {
     for scenario in $scenarios; do
         cd $scenario
         # collect all ceph logs from all test nodes
-        collect_ceph_logs $venv all
+        collect_ceph_logs $venv all "$collect_logs_playbook_path"
         vagrant destroy -f
         stat ./fetch > /dev/null 2>&1 && rm -rf ./fetch
         cd -