From 17b9ff03d27efc84581e22e1190934b2355a3baa Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Tue, 20 Jul 2021 15:53:48 -0400 Subject: [PATCH] common: fix py2 pool_list from_json when skipped 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 (cherry picked from commit cf6e33346e09e680d9b69cafdc24fdd8801cdbf4) --- infrastructure-playbooks/rolling_update.yml | 2 +- ...tch-from-non-containerized-to-containerized-ceph-daemons.yml | 2 +- roles/ceph-handler/tasks/handler_osds.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index ce5075723..9ccfa8197 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -399,7 +399,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" diff --git a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml index 3882526ec..667e95900 100644 --- a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml +++ b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml @@ -230,7 +230,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" diff --git a/roles/ceph-handler/tasks/handler_osds.yml b/roles/ceph-handler/tasks/handler_osds.yml index 8d0717e3d..f16a06360 100644 --- a/roles/ceph-handler/tasks/handler_osds.yml +++ b/roles/ceph-handler/tasks/handler_osds.yml @@ -27,7 +27,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" -- 2.39.5