Skip to content

Commit

Permalink
Change order of operations (#719)
Browse files Browse the repository at this point in the history
Add new/updated key to dict only after removing old ones

Co-authored-by: Marges, RSY (Rick) <[email protected]>
Co-authored-by: Sean Sullivan <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2023
1 parent 4596d83 commit bc6e8e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/lookup/controller_object_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def create_present_list(self, compare_list):

def map_item(self, item, new_attribute_name, attribute_value, dupitems):
new_item = copy.deepcopy(item)
new_item.update({new_attribute_name: attribute_value})
for dupitem in [dupitem for dupitem in dupitems if dupitem in new_item]:
new_item.pop(dupitem)
new_item.update({new_attribute_name: attribute_value})
return new_item

def run(self, terms, variables=None, **kwargs):
Expand Down
6 changes: 3 additions & 3 deletions roles/object_diff/tasks/roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
- __controller_api_current_user_check_is_admin.is_superuser
block:

- name: "Get the API list of all roles" # noqa jinja[spacing]
- name: "Get the API list of all roles"
ansible.builtin.set_fact:
__controller_api_roles: "{{ (__controller_api_roles | default([])) + [{
'users': current_users,
'teams': current_teams,
'name': current_role.name,
'role': current_role.name,
'type': current_role.type,
'resource_type': (current_role.summary_fields.resource_type|default('no_resource_type')),
(current_role.summary_fields.resource_type|default('no_resource_type')): (current_role.summary_fields.resource_name|default('no_resource_name'))
'resource_type': (current_role.summary_fields.resource_type | default('no_resource_type')),
(current_role.summary_fields.resource_type | default('no_resource_type')): (current_role.summary_fields.resource_name | default('no_resource_name'))
}]
}}"
vars:
Expand Down

0 comments on commit bc6e8e5

Please sign in to comment.