Skip to content
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

Prevent traceback when task depth exceeds python recursion depth #73999

Merged
merged 4 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/73996-recursion-depth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- Task depth - Prevent exception when the task depth exceeds Pythons recursion depth
(https://github.com/ansible/ansible/issues/73996)
6 changes: 5 additions & 1 deletion lib/ansible/playbook/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from ansible import constants as C
from ansible import context
from ansible.errors import AnsibleError
from ansible.module_utils.six import iteritems, string_types, with_metaclass
from ansible.module_utils.parsing.convert_bool import boolean
from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, AnsibleAssertionError
Expand Down Expand Up @@ -315,7 +316,10 @@ def copy(self):
Create a copy of this object and return it.
'''

new_me = self.__class__()
try:
new_me = self.__class__()
except RuntimeError as e:
raise AnsibleError("Exceeded maximum object depth. This may have been caused by excessive role recursion", orig_exc=e)

for name in self._valid_attrs.keys():
if name in self._alias_attrs:
Expand Down