From 364313c01f9cb94cdabffe694ca05d6cde16a9ed Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 3 Sep 2015 00:05:16 -0700 Subject: [PATCH] Simplify and speed up _split_role_params() by moving an invariant outside of a loop. --- lib/ansible/playbook/role/definition.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/playbook/role/definition.py b/lib/ansible/playbook/role/definition.py index 4f23766cd14..2d46cb7ddde 100644 --- a/lib/ansible/playbook/role/definition.py +++ b/lib/ansible/playbook/role/definition.py @@ -178,10 +178,11 @@ class RoleDefinition(Base, Become, Conditional, Taggable): role_def = dict() role_params = dict() + base_attribute_names = frozenset(self._get_base_attributes().keys()) for (key, value) in iteritems(ds): # 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) - if key not in [attr_name for (attr_name, attr_value) in iteritems(self._get_base_attributes())]: + if key not in base_attribute_names: # this key does not match a field attribute, so it must be a role param role_params[key] = value else: