Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend_setup role fails with ansible-core 2.13.3 and Python 3.9 #135

Closed
anoopcs9 opened this issue Sep 19, 2022 · 4 comments
Closed

backend_setup role fails with ansible-core 2.13.3 and Python 3.9 #135

anoopcs9 opened this issue Sep 19, 2022 · 4 comments

Comments

@anoopcs9
Copy link

anoopcs9 commented Sep 19, 2022

We have been noticing the following failure since the update to ansible 2.13.3 with its dependency on Python 3.9 on CentOS Stream 8:

TASK [gluster.infra/roles/backend_setup : Group devices by volume group name, including existing devices] ***
fatal: [storage0]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was:
'str object' has no attribute 'vgname'\n\nThe error appears to be in '/etc/ansible/roles/gluster.infra/roles/
backend_setup/task/get_vg_groupings.yml': line 3, column 3, but may\nbe elsewhere in the file depending on
the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Group devices by volume group
name, including existing devices\n  ^ here\n"}
fatal: [storage1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was:
'str object' has no attribute 'vgname'\n\nThe error appears to be in '/etc/ansible/roles/gluster.infra/roles/
backend_setup/tasks/get_vg_groupings.yml': line 3, column 3, but may\nbe elsewhere in the file depending on
the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Group devices by volume group
name, including existing devices\n  ^ here\n"}
@anoopcs9 anoopcs9 changed the title backend_setup role fails with ansiblec-core 2.13.3 and Python 3.9 backend_setup role fails with ansible-core 2.13.3 and Python 3.9 Sep 19, 2022
@anoopcs9
Copy link
Author

anoopcs9 commented Sep 23, 2022

It seems like a regression with Ansible v2.12 was helping us hide this issue till it was fixed with v2.13. Quoting some points from various related issues from Ansible:

  • to_json and to_nice_json ALWAYS are supposed to return a string (of serialized JSON) otherwise they would be a Python dictionary/list. Ansible tends to automatically convert JSON into Python data structures, though we have some safeguards against it when explicitly using those filters (which would create the behavior you see).
  • You should really only use to_json/to_nice_json on things that are Ansible variables

Therefore we must refrain from using to_json filter on variables within Jinja2 template.

Issue references: ansible/ansible#77004, ansible/ansible#76443

anoopcs9 added a commit to gluster/samba-integration that referenced this issue Sep 23, 2022
See gluster/gluster-ansible-infra#135 for more
details. Revert previous change which updated pip executable from 3.8 to
3.9 as Ansible v2.12.x is still built with Python 3.8.
rchikatw added a commit to rchikatw/gluster-ansible-infra that referenced this issue Dec 5, 2022
…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
@dkelson
Copy link

dkelson commented Dec 12, 2022

This makes it so oVirt 4.5.4 with ovirt-node-ng-installer-latest-el8.iso (currently links to 4.5.4-2022120615) won't install.

@itg-dave
Copy link

Until #136 is merged:

sed -i 's/output | to_json/output/' /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/get_vg_groupings.yml
sed -i 's/output | to_json/output/' /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thick_lv_create.yml
sed -i 's/output | to_json/output/' /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thin_pool_create.yml
sed -i 's/output | to_json/output/' /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thin_volume_create.yml

anoopcs9 added a commit to anoopcs9/sit-environment that referenced this issue Oct 6, 2023
Recently the following error is seen while trying to install ansible
collections:

[WARNING]: Skipping Galaxy server https://galaxy.ansible.com/api/. Got
  an unexpected error when getting available versions of collection community.general:
  '/api/v3/plugin/ansible/content/published/collections/index/community/general/versions/'
ERROR! Unexpected Exception, this is probably a bug:
  '/api/v3/plugin/ansible/content/published/collections/index/community/general/versions/'

We are already stuck with ansible version from 2.12.x series due to
another issue[1] from gluster-ansible-infra and fix for the above error
is only available from v2.12.8[2]. Given that the fixed version is out
for a while and updates are not yet released via repositories we could
only keep it running with a workaround of disabling the cache while
fetching the versions for a particular collection as described in
upstream issue[3].

[1] gluster/gluster-ansible-infra#135
[2] ansible/ansible#81830 (comment)
[3] ansible/ansible#77911 (comment)

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
anoopcs9 added a commit to samba-in-kubernetes/sit-environment that referenced this issue Oct 6, 2023
Recently the following error is seen while trying to install ansible
collections:

[WARNING]: Skipping Galaxy server https://galaxy.ansible.com/api/. Got
  an unexpected error when getting available versions of collection community.general:
  '/api/v3/plugin/ansible/content/published/collections/index/community/general/versions/'
ERROR! Unexpected Exception, this is probably a bug:
  '/api/v3/plugin/ansible/content/published/collections/index/community/general/versions/'

We are already stuck with ansible version from 2.12.x series due to
another issue[1] from gluster-ansible-infra and fix for the above error
is only available from v2.12.8[2]. Given that the fixed version is out
for a while and updates are not yet released via repositories we could
only keep it running with a workaround of disabling the cache while
fetching the versions for a particular collection as described in
upstream issue[3].

[1] gluster/gluster-ansible-infra#135
[2] ansible/ansible#81830 (comment)
[3] ansible/ansible#77911 (comment)

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
anoopcs9 added a commit to anoopcs9/sit-environment that referenced this issue Oct 10, 2023
Unavailability of complete gluster-ansible packages and limitation[1]
to use latest ansible versions forces us to setup GlusterFS cluster
using older versions on CentOS 8 platform.

[1] gluster/gluster-ansible-infra#135

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
anoopcs9 added a commit to anoopcs9/sit-environment that referenced this issue Oct 10, 2023
Unavailability of complete gluster-ansible packages and limitation[1]
to use latest ansible versions forces us to setup GlusterFS cluster
using older versions on CentOS 8 platform.

[1] gluster/gluster-ansible-infra#135

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
anoopcs9 added a commit to anoopcs9/sit-environment that referenced this issue Oct 10, 2023
Unavailability of complete gluster-ansible packages and limitation[1]
to use latest ansible versions forces us to setup GlusterFS cluster
using older versions on CentOS 8 platform.

[1] gluster/gluster-ansible-infra#135

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
xhernandez pushed a commit to samba-in-kubernetes/sit-environment that referenced this issue Oct 11, 2023
Unavailability of complete gluster-ansible packages and limitation[1]
to use latest ansible versions forces us to setup GlusterFS cluster
using older versions on CentOS 8 platform.

[1] gluster/gluster-ansible-infra#135

Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
@anoopcs9
Copy link
Author

anoopcs9 commented Jun 6, 2024

Fixed by #136

@anoopcs9 anoopcs9 closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants