Skip to content

Commit 4487e41

Browse files
BenoitKnechtguits
authored andcommitted
ceph-facts: Fix get_def_crush_rule_name.yml in check mode
This construct doesn't work as intended since ansible/ansible#74212: ``` item.stdout | default('{}') | from_json ``` That PR made the `command` module return `stdout` even in check mode (setting it to the empty string), so `default()` has no effect in that case and `from_json()` fails to parse an empty string. Instead, `default()` needs to be invoked with its second argument set to `True`, so that it replaces any `False` value (such as an empty string) with its first argument: ``` item.stdout | default('{}', True) | from_json ``` Signed-off-by: Benoît Knecht <bknecht@protonmail.ch> (cherry picked from commit 7684d89)
1 parent 3ba0e4b commit 4487e41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

roles/ceph-facts/tasks/get_def_crush_rule_name.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
- name: get current default crush rule name
1010
set_fact:
1111
ceph_osd_pool_default_crush_rule_name: "{{ item.rule_name }}"
12-
with_items: "{{ default_crush_rule_details.stdout | default('{}') | from_json }}"
12+
with_items: "{{ default_crush_rule_details.stdout | default('{}', True) | from_json }}"
1313
run_once: True
14-
when: item.rule_id | int == osd_pool_default_crush_rule | int
14+
when: item.rule_id | int == osd_pool_default_crush_rule | int

0 commit comments

Comments
 (0)