Skip to content

Commit

Permalink
common: fix py2 pool_list from_json when skipped
Browse files Browse the repository at this point in the history
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 cf6e333)
  • Loading branch information
dsavineau committed Jul 21, 2021
1 parent f3a9135 commit f9d6064
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion infrastructure-playbooks/cephadm-adopt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,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"
Expand Down
2 changes: 1 addition & 1 deletion infrastructure-playbooks/rolling_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,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"
Expand Down
2 changes: 1 addition & 1 deletion roles/ceph-handler/tasks/handler_osds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f9d6064

Please sign in to comment.