]> git-server-git.apps.pok.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)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 21 Jul 2021 06:17:58 +0000 (08:17 +0200)
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>
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 6730085252312fce8b64dfcbdaa14f120773384d..21dcca2cb468aea031008effa93f23ed46fff03a 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 c578eb7859d61d9f12c1299857182e0158280f3e..2638d557409e0e68857a081d5ddef81521177bc1 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 e1fb0ac92f8a0ae27245136777704c43115ca3cb..7643f59f52dd5eba6a0e68bfbfab2895b2f5cf95 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"