Skip to content

Commit 9df27fc

Browse files
BenoitKnechtguits
authored andcommitted
ceph-osd: Fix start_osds.yml in check mode
This construct doesn't work as intended since ansible/ansible#74212: ``` ceph_osd_ids.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: ``` ceph_osd_ids.stdout | default('{}', True) | from_json ``` Signed-off-by: Benoît Knecht <bknecht@protonmail.ch> (cherry picked from commit 0b3a608)
1 parent 0431746 commit 9df27fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

roles/ceph-osd/tasks/start_osds.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
mode: "{{ ceph_directories_mode }}"
5858
owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
5959
group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
60-
with_items: "{{ ((ceph_osd_ids.stdout | default('{}') | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"
60+
with_items: "{{ ((ceph_osd_ids.stdout | default('{}', True) | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"
6161

6262
- name: systemd start osd
6363
systemd:
@@ -66,4 +66,4 @@
6666
enabled: yes
6767
masked: no
6868
daemon_reload: yes
69-
with_items: "{{ ((ceph_osd_ids.stdout | default('{}') | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"
69+
with_items: "{{ ((ceph_osd_ids.stdout | default('{}', True) | from_json).keys() | list) | union(osd_ids_non_container.stdout_lines | default([])) }}"

0 commit comments

Comments
 (0)