]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
mon: default ceph_health_raw to json
authorSébastien Han <seb@redhat.com>
Mon, 26 Nov 2018 10:08:27 +0000 (11:08 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 3 Dec 2018 13:39:43 +0000 (14:39 +0100)
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>
roles/ceph-mon/tasks/ceph_keys.yml

index c5fba8ea5231c9a503fafa3b50f81e7c8ee874b2..24c5548c09c1107bfd251491207c316c9275c5e5 100644 (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: