]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
scripts: adds a collect_ceph_logs function
authorAndrew Schoen <aschoen@redhat.com>
Thu, 8 Mar 2018 20:37:06 +0000 (14:37 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 8 Mar 2018 21:06:28 +0000 (15:06 -0600)
This function will use ansible to connect to all testing
vms and fetch in ceph logs to the jenkins slave. These logs
can then be archived by jenkins.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
scripts/build_utils.sh

index 42a86361f1f9478d679c1bb0b823239e558b1a1c..a5436d9f6c4df06ea397922ddc59617e67cb23cd 100644 (file)
@@ -697,3 +697,25 @@ write_collect_logs_playbook() {
       with_items: "{{ ceph_logs.stdout_lines }}"
 EOF
 }
+
+collect_ceph_logs() {
+    # 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 slave.
+    # 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
+
+        pkgs=( "ansible" )
+        install_python_packages "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
+    fi
+}