]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
use get to check stdout_lines
authorSébastien Han <seb@redhat.com>
Fri, 6 Oct 2017 14:49:46 +0000 (16:49 +0200)
committerSébastien Han <seb@redhat.com>
Fri, 6 Oct 2017 14:57:46 +0000 (16:57 +0200)
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>
roles/ceph-defaults/handlers/main.yml

index d3a4629e98d6b3993c3a9db3991d1925724c6626..36edca8292aac24ac37f3f0398dfb2bfaebd1aa8 100644 (file)
@@ -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
     # 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:
     # 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:
     # 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:
     # 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:
     # 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