]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
common: fix py2 pool_list from_json when skipped
authorDimitri Savineau <dsavinea@redhat.com>
Tue, 20 Jul 2021 19:53:48 +0000 (15:53 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Wed, 21 Jul 2021 12:57:53 +0000 (08:57 -0400)
When using python 2 and the task with a loop is skipped then it generates
an error.

Unexpected templating type error occurred on
({{ (pool_list.stdout | from_json)['pools'] }}): expected string or buffer

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit cf6e33346e09e680d9b69cafdc24fdd8801cdbf4)

infrastructure-playbooks/cephadm-adopt.yml
infrastructure-playbooks/rolling_update.yml
infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml
roles/ceph-handler/tasks/handler_osds.yml

index b0eb7b227234bf9a4a2dc124e5fb587e6e8baab3..7cc99c552a37559e39542f63b366db849a2bebdd 100644 (file)
       set_fact:
         pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
       run_once: true
-      with_items: "{{ (pool_list.stdout | from_json)['pools'] }}"
+      with_items: "{{ (pool_list.stdout | default('{}') | from_json)['pools'] }}"
 
     - name: disable balancer
       command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"
index f0c0b774a1b268c7e03e96b51c97be37212daca8..83f98556cbfa774cf34af726191c73168c6f080d 100644 (file)
       set_fact:
         pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
       run_once: true
-      with_items: "{{ (pool_list.stdout | from_json)['pools'] }}"
+      with_items: "{{ (pool_list.stdout | default('{}') | from_json)['pools'] }}"
 
     - name: disable balancer
       command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"
index d592147367c6db4612d53e41078bdec83532877f..e14f83a31e6f2737fe83a95e92da0ea6b47d37e7 100644 (file)
       set_fact:
         pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
       run_once: true
-      with_items: "{{ (pool_list.stdout | from_json)['pools'] }}"
+      with_items: "{{ (pool_list.stdout | default('{}') | from_json)['pools'] }}"
 
     - name: disable balancer
       command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"
index 48c27c4ea6303455aa0bb8ed780fbf2758981410..a29d791bc87214ba081a7ec921edadef48d0fd95 100644 (file)
@@ -56,7 +56,7 @@
       set_fact:
         pools_pgautoscaler_mode: "{{ pools_pgautoscaler_mode | default([]) | union([{'name': item.pool_name, 'mode': item.pg_autoscale_mode}]) }}"
       run_once: true
-      with_items: "{{ (pool_list.stdout | from_json)['pools'] }}"
+      with_items: "{{ (pool_list.stdout | default('{}') | from_json)['pools'] }}"
 
     - name: disable balancer
       command: "{{ ceph_cmd }} --cluster {{ cluster }} balancer off"