From: Sébastien Han Date: Fri, 6 Oct 2017 14:49:46 +0000 (+0200) Subject: use get to check stdout_lines X-Git-Tag: v3.0.0rc18~1^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=779f642fa85e2df6f2b4a503022bbad4fe315a44;p=ceph-ansible.git use get to check stdout_lines During the initial play, the docker command doesn't not exist and then there is no stdout_lines to the command. So get allows us to fix this by declaring an array if the command fails. Signed-off-by: Sébastien Han --- diff --git a/roles/ceph-defaults/handlers/main.yml b/roles/ceph-defaults/handlers/main.yml index d3a4629e9..36edca829 100644 --- a/roles/ceph-defaults/handlers/main.yml +++ b/roles/ceph-defaults/handlers/main.yml @@ -33,7 +33,7 @@ # We do not want to run these checks on initial deployment (`socket.rc == 0`) - mon_group_name in group_names - containerized_deployment - - ceph_mon_container_stat.stdout_lines|length != 0 + - ceph_mon_container_stat.get('stdout_lines', [])|length != 0 # This does not just restart OSDs but everything else too. Unfortunately # at this time the ansible role does not have an OSD id list to use @@ -72,7 +72,7 @@ # except when a crush location is specified. ceph-disk will start the osds before the osd crush location is specified - osd_group_name in group_names - containerized_deployment - - ((crush_location is defined and crush_location) or ceph_osd_container_stat.stdout_lines|length != 0) + - ((crush_location is defined and crush_location) or ceph_osd_container_stat.get('stdout_lines', [])|length != 0) - handler_health_osd_check # See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below - inventory_hostname in play_hosts @@ -105,7 +105,7 @@ # We do not want to run these checks on initial deployment (`socket.rc == 0`) - mds_group_name in group_names - containerized_deployment - - ceph_mds_container_stat.stdout_lines|length != 0 + - ceph_mds_container_stat.get('stdout_lines', [])|length != 0 - name: copy rgw restart script template: @@ -135,7 +135,7 @@ # We do not want to run these checks on initial deployment (`socket.rc == 0`) - rgw_group_name in group_names - containerized_deployment - - ceph_rgw_container_stat.stdout_lines|length != 0 + - ceph_rgw_container_stat.get('stdout_lines', [])|length != 0 - name: copy nfs restart script template: @@ -165,7 +165,7 @@ # We do not want to run these checks on initial deployment (`socket.rc == 0`) - nfs_group_name in group_names - containerized_deployment - - ceph_nfs_container_stat.stdout_lines|length != 0 + - ceph_nfs_container_stat.get('stdout_lines', [])|length != 0 - name: copy rbd mirror restart script template: @@ -195,7 +195,7 @@ # We do not want to run these checks on initial deployment (`socket.rc == 0`) - rbdmirror_group_name in group_names - containerized_deployment - - ceph_rbd_mirror_container_stat.stdout_lines|length != 0 + - ceph_rbd_mirror_container_stat.get('stdout_lines', [])|length != 0 - name: copy mgr restart script template: @@ -225,4 +225,4 @@ # We do not want to run these checks on initial deployment (`socket.rc == 0`) - mgr_group_name in group_names - containerized_deployment - - ceph_mgr_container_stat.stdout_lines|length != 0 + - ceph_mgr_container_stat.get('stdout_lines', [])|length != 0