manage levels for 'multiple included lists' (#46359)
* manage levels for 'multiple included lists'
fixes #46343
(cherry picked from commit 80d977bac6
)
(cherry picked from commit ef6637895301842ff0a62f35ef1a6e517af60e39)
This commit is contained in:
parent
d61d285a6f
commit
78da8341a5
2 changed files with 4 additions and 2 deletions
2
changelogs/fragments/fix_flatten.yml
Normal file
2
changelogs/fragments/fix_flatten.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- fix flatten to properly handle multiple lists in lists https://github.com/ansible/ansible/issues/46343
|
|
@ -463,8 +463,8 @@ def flatten(mylist, levels=None):
|
|||
if levels is None:
|
||||
ret.extend(flatten(element))
|
||||
elif levels >= 1:
|
||||
levels = int(levels) - 1
|
||||
ret.extend(flatten(element, levels=levels))
|
||||
# decrement as we go down the stack
|
||||
ret.extend(flatten(element, levels=(int(levels) - 1)))
|
||||
else:
|
||||
ret.append(element)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue