Browse Source

Make Get OSD stat percentage compatible with jq < 1.5

On upgrades we're using validations (from train) against controller that
are still on queens. On queens jq package is <1.5 and the "try" keyword
is not available.
This purpose of this change is to fix this validations getting rid of
"try-catch" in favour of "if-else" which works for 1.3+ < jq < 1.5.

Change-Id: Id16ccf69888ceb03cc33e0627de5270f9c8f4b95
Closes-Bug: #1889279
changes/92/743592/3
Francesco Pantano 2 weeks ago
parent
commit
6c19d1bcdf
No known key found for this signature in database GPG Key ID: 799868C47301D458
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      roles/ceph/tasks/ceph-health.yaml

+ 3
- 1
roles/ceph/tasks/ceph-health.yaml View File

@@ -63,9 +63,11 @@
- when:
- osd_percentage_min|default(0) > 0
block:
# 1.3+ <= jq <= 1.5 doesn't support try-catch: we rely on if - then -else approach to check if ceph has .osdmap layout
- name: set jq osd percentage filter
set_fact:
jq_osd_percentage_filter: '( (try .osdmap.num_in_osds + try .num_in_osds) / (try .osdmap.num_osds + try .num_osds)) * 100'
jq_osd_percentage_filter: '(if .osdmap != null then { osds: (.osdmap.num_in_osds / .osdmap.num_osds * 100) }
else { osds: (.num_in_osds / .num_osds * 100) } end) | .osds'

- name: Get OSD stat percentage
become: true


Loading…
Cancel
Save