From f32bf240d203d16ef9004fe90ce81790822d3632 Mon Sep 17 00:00:00 2001 From: ricolin Date: Tue, 2 Apr 2024 17:06:58 +0800 Subject: [PATCH] fix TMPFILE reference --- roles/osd/tasks/main.yml | 1 + roles/osd/templates/prom-bs-frag-score-collector.sh.j2 | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/osd/tasks/main.yml b/roles/osd/tasks/main.yml index 1d0f691..3cec635 100644 --- a/roles/osd/tasks/main.yml +++ b/roles/osd/tasks/main.yml @@ -128,6 +128,7 @@ - inventory_hostname == groups[ceph_osd_osds_group] | last - name: Make sure `/var/lib/cron` directory exists + when: ceph_bluestore_frag_collect ansible.builtin.file: path: /var/lib/cron state: directory diff --git a/roles/osd/templates/prom-bs-frag-score-collector.sh.j2 b/roles/osd/templates/prom-bs-frag-score-collector.sh.j2 index 5fb33cb..bb78303 100644 --- a/roles/osd/templates/prom-bs-frag-score-collector.sh.j2 +++ b/roles/osd/templates/prom-bs-frag-score-collector.sh.j2 @@ -3,13 +3,13 @@ export TMPFILE=/tmp/bluestore_allocator_score_block.prom.$$ osd_path=$(find /var/lib/ceph/{{ ceph_mon_fsid }}/ -type d -name "osd.*"| head -n 1) -if [ -z $osd_path ]; then +if [ ! -z $osd_path ]; then cephadm --image "{{ cephadm_image }}" shell --fsid "{{ ceph_mon_fsid }}" \ --config "$osd_path/config" \ - -m /var/lib/cron/bs-frag-score.sh -- ./mnt/bs-frag-score.sh > TMPFILE + -m /var/lib/cron/bs-frag-score.sh -- ./mnt/bs-frag-score.sh > $TMPFILE else cephadm --image "{{ cephadm_image }}" shell --fsid "{{ ceph_mon_fsid }}" \ - -m /var/lib/cron/bs-frag-score.sh -- ./mnt/bs-frag-score.sh > TMPFILE + -m /var/lib/cron/bs-frag-score.sh -- ./mnt/bs-frag-score.sh > $TMPFILE fi mv $TMPFILE /tmp/bluestore_allocator_score_block.prom