From 80d977bac65768bdd5cd675b9d1794640749431a Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 10 Oct 2018 12:34:58 -0400 Subject: [PATCH] manage levels for 'multiple included lists' (#46359) * manage levels for 'multiple included lists' fixes #46343 --- lib/ansible/plugins/filter/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/filter/core.py b/lib/ansible/plugins/filter/core.py index b572ab4d8ab..eab00228884 100644 --- a/lib/ansible/plugins/filter/core.py +++ b/lib/ansible/plugins/filter/core.py @@ -440,8 +440,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: