From 29753da05c4d474b67f97d8f812514efb03f28a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Fri, 25 Aug 2017 18:00:03 +0200 Subject: [PATCH] handler: default to empty array if task skipped MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit with_items is evaluated before the when condition so if the task that registers the 'results' is skipped the task will fail with: {"failed": true, "msg": "'dict object' has no attribute 'results'"} Defaulting to an empty array fixes the issue. Reverts: abdd66619e1d5c94f74e994bff667b5ccc6b529f Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1482061 Signed-off-by: Sébastien Han --- roles/ceph-defaults/handlers/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/ceph-defaults/handlers/main.yml b/roles/ceph-defaults/handlers/main.yml index 760c7f1da..3a053d435 100644 --- a/roles/ceph-defaults/handlers/main.yml +++ b/roles/ceph-defaults/handlers/main.yml @@ -40,12 +40,11 @@ - name: restart containerized ceph osds daemon(s) command: /tmp/restart_osd_daemon.sh listen: "restart ceph osds" - with_items: "{{ socket_osd_container.results }}" + with_items: "{{ socket_osd_container.results | default([]) }}" when: # We do not want to run these checks on initial deployment (`socket_osd_container.results[n].rc == 0`) # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified - containerized_deployment - - not item.get("skipped") - ((crush_location is defined and crush_location) or item.get('rc') == 0) - handler_health_osd_check # See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below -- 2.39.5