Bug 1224417 - ansible jinja template fails on dict.keys() call
Summary: ansible jinja template fails on dict.keys() call
Status: NEW
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: Other (show other bugs)
Version: Leap 15.5
Hardware: All Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Johannes Kastl
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-17 12:45 UTC by Richard Dörwaldt
Modified: 2024-05-23 12:30 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Dörwaldt 2024-05-17 12:45:21 UTC
User-Agent:       Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0
Build Identifier: 

After upgrade to ansible-2.9.27-150000.1.17.2.noarch the following fails:

$ rpm -qa ansible
ansible-2.9.27-150000.1.17.2.noarch
$ ansible -m debug -a 'msg="{{ {\"a\": 3}.keys() }}"' localhost
localhost | FAILED! => {
    "msg": "Unexpected templating type error occurred on ({{ {\"a\": 3}.keys() }}): unhashable type: 'dict'"
}

On a system with the previous version ansible-2.9.27-bp155.2.16.noarch installed, it works:

$ rpm -qa ansible
ansible-2.9.27-bp155.2.16.noarch
$ ansible -m debug -a 'msg="{{ {\"a\": 3}.keys() }}"' localhost
localhost | SUCCESS => {
    "msg": "dict_keys(['a'])"
}


Reproducible: Always

Steps to Reproduce:
1. zypper in ansible
2. ansible -m debug -a 'msg="{{ {\"a\": 3}.keys() }}"' localhost

Actual Results:  
localhost | FAILED! => {
    "msg": "Unexpected templating type error occurred on ({{ {\"a\": 3}.keys() }}): unhashable type: 'dict'"
}

Expected Results:  
localhost | SUCCESS => {
    "msg": "dict_keys(['a'])"
}
Comment 1 Johannes Kastl 2024-05-21 09:22:28 UTC
Hi,

thanks for the bug report, but ansible 2.9.27 is EOL and has been for some years. There are recent packages available for Tumbleweed.

For Leap15 and SLES15 work is done to get those into PackageHub/Backports.

I planned to build packages for 15.x in systemsmanagement:ansible, but this far only had time to prepare those in my home:

https://build.opensuse.org/project/show/home:ojkastl_buildservice:Branch_systemsmanagement_ansible

I strongly advise against using the old 2.9.x versions!

Kind Regards,
Johannes
Comment 2 Richard Dörwaldt 2024-05-23 12:30:08 UTC
(In reply to Johannes Kastl from comment #1)
> Hi,
> 
> thanks for the bug report, but ansible 2.9.27 is EOL and has been for some
> years. There are recent packages available for Tumbleweed.
> 
> For Leap15 and SLES15 work is done to get those into PackageHub/Backports.
> 
> I planned to build packages for 15.x in systemsmanagement:ansible, but this
> far only had time to prepare those in my home:
> 
> https://build.opensuse.org/project/show/home:ojkastl_buildservice:
> Branch_systemsmanagement_ansible
> 
> I strongly advise against using the old 2.9.x versions!
> 
> Kind Regards,
> Johannes

Thanks Johannes.
I didn't realize it was that old.

Is there any more current version available for leap 15.5 now or will that only be available once it makes it into backports?
And will that then be based on the version you linked?

BR/richard