mon: default ceph_health_raw to json

During the first iteration, the command won't return anything, or can
simply fail and might not return a valid json structure. Ansible will
fail parsing it in the filter `from_json` so let's default that variable
to empty dictionary.

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/3375/head
Sébastien Han 2018-11-26 11:08:27 +01:00 committed by Guillaume Abrioux
parent cfac79bec4
commit 8d4de44f5d
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@
command: "ceph --cluster {{ cluster }} -n mon. -k /var/lib/ceph/mon/{{ cluster }}-{{ ansible_hostname }}/keyring mon_status --format json"
register: ceph_health_raw
until: >
(ceph_health_raw.stdout | from_json)['state'] in ['leader', 'peon']
(ceph_health_raw.stdout | default({}) | from_json)['state'] in ['leader', 'peon']
retries: "{{ handler_health_mon_check_retries }}"
delay: "{{ handler_health_mon_check_delay }}"
when: