1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Allow certain base attributes to be used as role params

Role definitions typically require params to be different from those
which are specified as FieldAttributes on the playbook classes used
for roles, however a certain subset should be allowed (typically those
used for connection stuff).

Fixes #14095
This commit is contained in:
James Cammarata 2016-01-24 23:02:55 -05:00
parent 6b166a1048
commit 2b02e8e2b4

View file

@ -188,7 +188,12 @@ class RoleDefinition(Base, Become, Conditional, Taggable):
for (key, value) in iteritems(ds): for (key, value) in iteritems(ds):
# use the list of FieldAttribute values to determine what is and is not # use the list of FieldAttribute values to determine what is and is not
# an extra parameter for this role (or sub-class of this role) # an extra parameter for this role (or sub-class of this role)
if key not in base_attribute_names: # FIXME: hard-coded list of exception key names here corresponds to the
# connection fields in the Base class. There may need to be some
# other mechanism where we exclude certain kinds of field attributes,
# or make this list more automatic in some way so we don't have to
# remember to update it manually.
if key not in base_attribute_names or key in ('connection', 'port', 'remote_user'):
# this key does not match a field attribute, so it must be a role param # this key does not match a field attribute, so it must be a role param
role_params[key] = value role_params[key] = value
else: else: