mirror of https://github.com/ceph/ceph-ansible.git
ceph-osd: Fix crush_rules.yml in check mode
Set a default value for `item.stdout` before passing it to `from_json()`. The
`when` condition doesn't prevent this template from being evaluated in check
mode, so it fails if `item.stdout` doesn't contain a valid JSON string.
Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit ef05e9a313
)
pull/7091/head
parent
54b400089c
commit
9675e146ee
|
@ -44,8 +44,8 @@
|
||||||
# NOTE(leseb): we should actually fail if multiple rules are set as default
|
# NOTE(leseb): we should actually fail if multiple rules are set as default
|
||||||
- name: set_fact info_ceph_default_crush_rule_yaml, ceph_osd_pool_default_crush_rule_name
|
- name: set_fact info_ceph_default_crush_rule_yaml, ceph_osd_pool_default_crush_rule_name
|
||||||
set_fact:
|
set_fact:
|
||||||
info_ceph_default_crush_rule_yaml: "{{ item.stdout | from_json() }}"
|
info_ceph_default_crush_rule_yaml: "{{ item.stdout | default('{}', True) | from_json() }}"
|
||||||
ceph_osd_pool_default_crush_rule_name: "{{ (item.stdout | from_json).rule_name }}"
|
ceph_osd_pool_default_crush_rule_name: "{{ (item.stdout | default('{}', True) | from_json).get('rule_name') }}"
|
||||||
with_items: "{{ info_ceph_default_crush_rule.results }}"
|
with_items: "{{ info_ceph_default_crush_rule.results }}"
|
||||||
run_once: true
|
run_once: true
|
||||||
when: not item.get('skipped', false)
|
when: not item.get('skipped', false)
|
||||||
|
|
Loading…
Reference in New Issue