]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
BugFix: Fix #1374 1396/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 23 Mar 2017 15:00:02 +0000 (16:00 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 27 Mar 2017 14:24:07 +0000 (16:24 +0200)
If a group of hosts is empty, (for instance 'mdss', in case of a
deployment without any mds node), the playbook will fails when trying
to restart service with `"'dict object' has no attribute u'XXX'"` error.

The idea here is to force the `with_items` statements in all included handler tasks
to get at least an empty array.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-common/handlers/restart-mds.yml
roles/ceph-common/handlers/restart-mon.yml
roles/ceph-common/handlers/restart-osd.yml
roles/ceph-common/handlers/restart-rgw.yml

index e6ff5ef4e27154d35fe6cba84e637393ecb3b1eb..142043f2758c5703ddb1b210eedb952c30e14286 100644 (file)
@@ -6,7 +6,7 @@
   # serial: 1 would be the proper solution here, but that can only be set on play level
   # upstream issue: https://github.com/ansible/ansible/issues/12170
   run_once: true
-  with_items: "{{ groups[mds_group_name] }}"
+  with_items: "{{ groups.get(mds_group_name, []) }}"
   delegate_to: "{{ item }}"
   when:
     - socket.rc == 0
index 440b7f2197d7cc95bf158b783c9270cf8e6b8e73..6776bd47ff7abef82e754aa05bfc46f1f5336d0d 100644 (file)
@@ -6,7 +6,7 @@
   # serial: 1 would be the proper solution here, but that can only be set on play level
   # upstream issue: https://github.com/ansible/ansible/issues/12170
   run_once: true
-  with_items: "{{ groups[mon_group_name] }}"
+  with_items: "{{ groups.get(mon_group_name, []) }}"
   delegate_to: "{{ item }}"
   when:
     - socket.rc == 0
index ad2fd4ffc1a1006c66f79958618e25b0e466ee6a..89c05303b1526ad58a87cfddbc9238620a47956f 100644 (file)
@@ -11,7 +11,7 @@
   # serial: 1 would be the proper solution here, but that can only be set on play level
   # upstream issue: https://github.com/ansible/ansible/issues/12170
   run_once: true
-  with_items: "{{ groups[osd_group_name] }}"
+  with_items: "{{ groups.get(osd_group_name, []) }}"
   delegate_to: "{{ item }}"
   when:
     - socket.rc == 0
index 5e52e9cc0eb1c2852ba5c285cb24d72cd6c460a0..479ac31ad4625794569126c7855a61679ac4fdfc 100644 (file)
@@ -6,7 +6,7 @@
   # serial: 1 would be the proper solution here, but that can only be set on play level
   # upstream issue: https://github.com/ansible/ansible/issues/12170
   run_once: true
-  with_items: "{{ groups[rgw_group_name] }}"
+  with_items: "{{ groups.get(rgw_group_name, []) }}"
   delegate_to: "{{ item }}"
   when:
     - socketrgw.rc == 0