-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
yum module fails with 'dict object' has no attribute '\\x00$' when used in loop and with dict lookup #15649
Comments
This shouldn't be closed, since this bug report isn't a bug in the |
After having looked at the associated PR and this bug... the bug itself could be fixed by having a try: except around squashing. If any exceptions are thrown, do not squash. That's a simple change because squashing is simply an optimization (one that we're discussing whether to deprecate since users can give the field a list [ using filters to construct the list if necessary ] instead of relying on squashing). This is probably a good thing to do regardless of whether we accept that PR as there could be other cornercases i nthe squashing code and we can recover from any of those in the same manner. |
* Allow variables that contain a dict lookup * Squash names built from dictionary values e.g. ``` package: name="{{item.name}}-{{item.version}}" with_items: - name: hello version: 1.2.3 - name: goodbye version: 2.3.4 ``` now works the same as ``` package: name="{{item}}" with_items: - hello-1.2.3 - goodbye-2.3.4 ``` * Fix some erroneous test assumptions e.g. ``` package: name="{{pkg_mgr}}" with_items: - hello-1.2.3 - goodbye-2.3.4 ``` should just install a single package with the name pkg_mgr (in effect item is not a bound variable) Fixes ansible#15649 Reordered some tests to better reflect comments
…ems loop. Also add more squashing testcases Fixes ansible#15649
…ems loop. Also add more squashing testcases Fixes #15649
…ems loop. Also add more squashing testcases Fixes #15649
Hi I had this task in my role that worked perfectly in 1.8.4 and with 2.0.2 it spat out 'dict object' has no attribute '\x00$'. The vars used above were stored in the defaults:
With de3f013 the error stopped appearing but it didn't install any package either (it was coloured green indicating no changes were done and indeed no package was installed). Amazingly it works this way in stock 2.0.2 (without the above patch):
Is it just me misusing 2.0.2 or it works not the way you intended? Some simpler cases using with_items: seem to work with non-dict-style items. I guess that it is this dict being used here that gives ansible a headache: {{grsecurity.latest_kernel_versions[item]}}-{{item}}. |
@szjur Can you apply this commit in addition to de3f013 and let us know if it works: b75895d ? I think what's happening is that the squashing function modifies the task.args in addition to returning the new list of squashed values. The fix I applied earlier returned the original list of values in case of an error but did not restore the task.args. This should fix that. I did something similar to what you're doing with dnf and it errored for me. I think with apt, you're specifying update_cache so it's silently updating the cache and nothing else instead of explicitly throwing an error. |
Excellent. The fix ha sbeen merged to the stable-2.1 branch and devel. We'll most likely get it into 2.1.0 but will decide on Monday (it will be in 2.1.1 if it doesn't make it into 2.1.0) |
This fix made it into 2.1.0. Closing ticket. |
ISSUE TYPE
ANSIBLE VERSION
CONFIGURATION
No configuration.
OS / ENVIRONMENT
Reproduced on Fedora 23. I'm connecting to localhost, however the error happens before connection attempt is made.
SUMMARY
Running the attached playbook produces the rather cryptic error
'dict object' has no attribute '\\x00$'
. The bug appears to be related to:as taking any out of the equation does not reproduce the error.
STEPS TO REPRODUCE
Run following playbook:
ansible-playbook -i hosts reproduce.yml -vvvv
EXPECTED RESULTS
Package
bar
to be installed usingyum
.ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: