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 <dsavinea@redhat.com>
(cherry picked from commit cf6e33346e)
pull/6738/head
Dimitri Savineau 2021-07-20 15:53:48 -04:00 committed by Dimitri Savineau
parent f7882bbc02
commit 17b9ff03d2
3 changed files with 3 additions and 3 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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"