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 <seb@redhat.com>
pull/2009/head
Sébastien Han 2017-10-06 16:49:46 +02:00
parent d5ae0a3340
commit 779f642fa8
1 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@
# We do not want to run these checks on initial deployment (`socket.rc == 0`) # We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mon_group_name in group_names - mon_group_name in group_names
- containerized_deployment - 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 # 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 # 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 # 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 - osd_group_name in group_names
- containerized_deployment - 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 - handler_health_osd_check
# See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below # See https://github.com/ceph/ceph-ansible/issues/1457 for the condition below
- inventory_hostname in play_hosts - inventory_hostname in play_hosts
@ -105,7 +105,7 @@
# We do not want to run these checks on initial deployment (`socket.rc == 0`) # We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mds_group_name in group_names - mds_group_name in group_names
- containerized_deployment - containerized_deployment
- ceph_mds_container_stat.stdout_lines|length != 0 - ceph_mds_container_stat.get('stdout_lines', [])|length != 0
- name: copy rgw restart script - name: copy rgw restart script
template: template:
@ -135,7 +135,7 @@
# We do not want to run these checks on initial deployment (`socket.rc == 0`) # We do not want to run these checks on initial deployment (`socket.rc == 0`)
- rgw_group_name in group_names - rgw_group_name in group_names
- containerized_deployment - containerized_deployment
- ceph_rgw_container_stat.stdout_lines|length != 0 - ceph_rgw_container_stat.get('stdout_lines', [])|length != 0
- name: copy nfs restart script - name: copy nfs restart script
template: template:
@ -165,7 +165,7 @@
# We do not want to run these checks on initial deployment (`socket.rc == 0`) # We do not want to run these checks on initial deployment (`socket.rc == 0`)
- nfs_group_name in group_names - nfs_group_name in group_names
- containerized_deployment - 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 - name: copy rbd mirror restart script
template: template:
@ -195,7 +195,7 @@
# We do not want to run these checks on initial deployment (`socket.rc == 0`) # We do not want to run these checks on initial deployment (`socket.rc == 0`)
- rbdmirror_group_name in group_names - rbdmirror_group_name in group_names
- containerized_deployment - 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 - name: copy mgr restart script
template: template:
@ -225,4 +225,4 @@
# We do not want to run these checks on initial deployment (`socket.rc == 0`) # We do not want to run these checks on initial deployment (`socket.rc == 0`)
- mgr_group_name in group_names - mgr_group_name in group_names
- containerized_deployment - containerized_deployment
- ceph_mgr_container_stat.stdout_lines|length != 0 - ceph_mgr_container_stat.get('stdout_lines', [])|length != 0