mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 23:44:00 -07:00
Don't use getattr in _get_parent_attribute to avoid recursion issues (#33595)
* Don't use getattr in _get_parent_attribute to avoid recursion issues Fixes #23609 * Move extend/prepend to field attribute Also removes _get_attr* methods that were basically just calling _get_parent_attribute because it needed to set those params. Also modifies _get_parent_attribute() to pull those values from the FieldAttributes instead of using the ones passed into the function. * Better fixes for _get_parent_attribute
This commit is contained in:
parent
ab5dbca47e
commit
ebf971f931
7 changed files with 53 additions and 54 deletions
|
@ -24,8 +24,22 @@ from copy import deepcopy
|
|||
|
||||
class Attribute:
|
||||
|
||||
def __init__(self, isa=None, private=False, default=None, required=False, listof=None, priority=0, class_type=None, always_post_validate=False,
|
||||
inherit=True, alias=None):
|
||||
def __init__(
|
||||
self,
|
||||
isa=None,
|
||||
private=False,
|
||||
default=None,
|
||||
required=False,
|
||||
listof=None,
|
||||
priority=0,
|
||||
class_type=None,
|
||||
always_post_validate=False,
|
||||
inherit=True,
|
||||
alias=None,
|
||||
extend=False,
|
||||
prepend=False,
|
||||
):
|
||||
|
||||
"""
|
||||
:class:`Attribute` specifies constraints for attributes of objects which
|
||||
derive from playbook data. The attributes of the object are basically
|
||||
|
@ -67,6 +81,8 @@ class Attribute:
|
|||
self.always_post_validate = always_post_validate
|
||||
self.inherit = inherit
|
||||
self.alias = alias
|
||||
self.extend = extend
|
||||
self.prepend = prepend
|
||||
|
||||
if default is not None and self.isa in ('list', 'dict', 'set'):
|
||||
self.default = deepcopy(default)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue