Skip to content

Commit

Permalink
Removing to_json because before ansible v2.13 its returning dictionar…
Browse files Browse the repository at this point in the history
…y and from its returning as string.

Actually the orignal behaviour of this function is to return string but in ansible 2.12 was a mistake i guess.
Now in ansible 2.13 the original behaviour is back so we don't need to use to_json
Refer Doc: ansible/ansible#76443 (comment)
Bug:- gluster#135
  • Loading branch information
rchikatw committed Dec 5, 2022
1 parent 6ce7885 commit 2c769ed
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
8 changes: 4 additions & 4 deletions roles/backend_setup/tasks/get_vg_groupings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
gluster_volumes_by_groupname_pre: >-
{%- set output={} -%}
{%- for grouper, devicesConf in volume_groups | groupby('vgname') -%}
{%- set confs=[] -%}
{%- set confs=[] -%}
{%- for deviceConf in devicesConf -%}
{%- if deviceConf.pvname is defined -%}
{%- for device in deviceConf.pvname.split(',') -%}
Expand All @@ -15,7 +15,7 @@
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{{- output.__setitem__(grouper, confs) -}}
{{- output.__setitem__(grouper, confs) -}}
{%- endfor -%}
{%- if hostvars[inventory_hostname].ansible_lvm is defined and hostvars[inventory_hostname].ansible_lvm.pvs is defined -%}
{%- for device, pvs in hostvars[inventory_hostname].ansible_lvm.pvs.items() -%}
Expand All @@ -24,7 +24,7 @@
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{{- output | to_json -}}
{{- output -}}
- name: Check if vg block device exists
shell: >
Expand All @@ -51,4 +51,4 @@
{{- output.__setitem__(vgname, confs) -}}
{%- endfor -%}
{%- endfor -%}
{{- output | to_json -}}
{{- output -}}
3 changes: 1 addition & 2 deletions roles/backend_setup/tasks/thick_lv_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{{- output.append({"vgname": cnf.vgname, "raid": cnf.raid | default() , "pvname": (cnf.pvs|default('')).split(',') | select | list | unique | join(',')}) -}}
{%- endif -%}
{%- endfor -%}
{{- output | to_json -}}
{{- output -}}
when: gluster_infra_thick_lvs is defined and gluster_infra_thick_lvs is not none and gluster_infra_thick_lvs|length >0

- name: Make sure thick pvs exists in volume group
Expand Down Expand Up @@ -129,4 +129,3 @@
loop_control:
index_var: index
when: item is not none and lv_device_exists.results[index].stdout_lines is defined and "0" not in lv_device_exists.results[index].stdout_lines

3 changes: 1 addition & 2 deletions roles/backend_setup/tasks/thin_pool_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
{{- output.append({"vgname": cnf.vgname, "pvname": (cnf.pvs|default('') ~ ',' ~ (cnf.meta_pvs|default(''))).split(',') | select | list | unique | join(',')}) -}}
{%- endif -%}
{%- endfor -%}
{{- output | to_json -}}
{{- output -}}
when: gluster_infra_thinpools is defined and gluster_infra_thinpools is not none and gluster_infra_thinpools|length >0

# https://github.com/ansible/ansible/issues/13262
Expand Down Expand Up @@ -298,4 +298,3 @@
# --zero n"
with_items: "{{ gluster_infra_thinpools }}"
when: gluster_infra_thinpools is defined and item.raid is not defined

3 changes: 1 addition & 2 deletions roles/backend_setup/tasks/thin_volume_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{{- output.append({"vgname": cnf.vgname, "pvname": (cnf.pvs|default('') ~ ',' ~ (cnf.meta_pvs|default(''))).split(',') | select | list | unique | join(',')}) -}}
{%- endif -%}
{%- endfor -%}
{{- output | to_json -}}
{{- output -}}
when: gluster_infra_lv_logicalvols is defined and gluster_infra_lv_logicalvols is not none and gluster_infra_lv_logicalvols|length >0


Expand Down Expand Up @@ -151,4 +151,3 @@
gluster_infra_lv_logicalvols is defined and gluster_infra_lv_logicalvols is not none and gluster_infra_lv_logicalvols|length >0 and item is defined and item is not none
and lvt_device_exists.results[index].stdout_lines is defined and "0" not in lvt_device_exists.results[index].stdout_lines
and ((item.opts is not defined or "raid" not in item.opts) and item.meta_pvs is not defined and item.meta_opts is not defined)

0 comments on commit 2c769ed

Please sign in to comment.