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

postgresql: Cast sorted_old_postgres_pods as list #1791

Merged
merged 1 commit into from Mar 27, 2024

Conversation

dsavineau
Copy link
Contributor

SUMMARY

With ansible 2.9.27 (operator-sdk v1.27.0) then the reverse filter returns an iterator so we need to cast it to list. The behavior doesn't exist when using a more recent operator-sdk version like v1.34.0 (ansible-core 2.15.8) but using the list filter on that version works too (even if not needed)

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
ADDITIONAL INFORMATION
TASK [Set info for previous postgres pod] **************************************
task path: /opt/ansible/roles/installer/tasks/database_configuration.yml:130
ok: [localhost] => {"ansible_facts": {"sorted_old_postgres_pods": "<list_reverseiterator object at 0x7f512f251fd0>"}, "changed": false}

TASK [Set info for previous postgres pod] **************************************
task path: /opt/ansible/roles/installer/tasks/database_configuration.yml:138
ok: [localhost] => {"ansible_facts": {"old_postgres_pod": "<"}, "changed": false}

(...)

TASK [postgres : Get old PostgreSQL version] ***********************************
task path: /opt/ansible/roles/installer/tasks/database_configuration.yml:159
fatal: [localhost]: FAILED! => {
    "msg": "The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'metadata'\n\nThe error appears to be in '/opt/ansible/roles/installer/tasks/database_configuration.yml': line 159, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Get old PostgreSQL version\n      ^ here\n"

With ansible 2.9.27 (operator-sdk v1.27.0) then the reverse filter
returns an iterator so we need to cast it to list.
The behavior doesn't exist when using a more recent operator-sdk
version like v1.34.0 (ansible-core 2.15.8) but using the list
filter on that version works too (even if not needed)

"sorted_old_postgres_pods": "<list_reverseiterator object at 0x7f539eaa5610>"

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
@rooftopcellist rooftopcellist merged commit 80a9e8c into ansible:devel Mar 27, 2024
6 checks passed
@rooftopcellist
Copy link
Member

Thanks for adding the backwards compatibility. We will likely need to be backwards compatible with the earlier ansible-operator-sdk image for the next 6-12 months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants