Prevent traceback when task depth exceeds python recursion depth (#73999)
This commit is contained in:
parent
1082e2ab79
commit
cf4a9fcd0f
2 changed files with 8 additions and 1 deletions
3
changelogs/fragments/73996-recursion-depth.yml
Normal file
3
changelogs/fragments/73996-recursion-depth.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
bugfixes:
|
||||||
|
- Task depth - Prevent exception when the task depth exceeds Pythons recursion depth
|
||||||
|
(https://github.com/ansible/ansible/issues/73996)
|
|
@ -15,6 +15,7 @@ from jinja2.exceptions import UndefinedError
|
||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible import context
|
from ansible import context
|
||||||
|
from ansible.errors import AnsibleError
|
||||||
from ansible.module_utils.six import iteritems, string_types, with_metaclass
|
from ansible.module_utils.six import iteritems, string_types, with_metaclass
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, AnsibleAssertionError
|
from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, AnsibleAssertionError
|
||||||
|
@ -315,7 +316,10 @@ class FieldAttributeBase(with_metaclass(BaseMeta, object)):
|
||||||
Create a copy of this object and return it.
|
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():
|
for name in self._valid_attrs.keys():
|
||||||
if name in self._alias_attrs:
|
if name in self._alias_attrs:
|
||||||
|
|
Loading…
Reference in a new issue