manage levels for 'multiple included lists' (#46359)

* manage levels for 'multiple included lists'

fixes #46343

(cherry picked from commit 80d977bac6)
pull/46776/head
Brian Coca 6 years ago committed by Brian Coca
parent 1c9b197119
commit ef66378953

@ -0,0 +1,2 @@
bugfixes:
- fix flatten to properly handle multiple lists in lists https://github.com/ansible/ansible/issues/46343

@ -438,8 +438,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…
Cancel
Save