Skip to content

Commit

Permalink
Simplify and speed up _split_role_params() by moving an invariant out…
Browse files Browse the repository at this point in the history
…side of a loop.
  • Loading branch information
abadger committed Sep 3, 2015
1 parent 1ae28f6 commit 364313c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ansible/playbook/role/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ def _split_role_params(self, ds):

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:
Expand Down

0 comments on commit 364313c

Please sign in to comment.