-
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
combine filter: fine list handling (option b) #57894
Conversation
The test
The test
|
efd032e
to
af365bb
Compare
da849c9
to
c3f0bbe
Compare
ping @bcoca (I made the change you asked for) |
@tchernomax can you please rebase so I can review the docs portion of this PR? thanks! |
``` >>> x=init={1:[2]} >>> x=x.copy() >>> x[1] += [3] >>> init {1: [2, 3]} ``` `+=` doesn't copy the list before modifying it. So by user `+=` we where modifying lists inside first parameter of merge_hash.
f1d056d
to
c24119a
Compare
Can someone relaunch the CI, I think the fail has nothing to do with my commit. ping @samccann @felixfontein |
CI restarted. |
thanks felix @samccann can you review ? (it would be awesome to see this one year old PR moving forward !) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs LTGM
Thanks @tchernomax for your patience on this Ansible fix! |
SUMMARY
see:
Solution (b)
args:
README: will come if this implementation is validated.
I didn't implement 'uniq' as I think 'append_np' and 'prepend_np' are more useful, and are equivalent to unique if list are already filtered from duplication.
non backward compatible:
[dict1, [dict2]] | combine
doesn't work anymore, because I thought it shouldn't. If you disagree,flatten(terms, levels=1) → flatten(terms)
and it's fixed.ISSUE TYPE
COMPONENT NAME
component =lib/ansible/plugins/filter/core.py
ADDITIONAL INFORMATION