Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change order of operations #719

Merged
merged 2 commits into from
Nov 1, 2023
Merged

Conversation

Rickmarges
Copy link
Contributor

What does this PR do?

Add new/updated key to dict only after removing old ones.

When using plural versions of the dupitems (for example job_templates), only team and role remain in the compare_list_reduced.
This is due to an error in the order of operations. A singluar version is added to the new dict and then all occurences of dupitems are removed. However, the singular version is also in that list.

In this PR the order is changed to first removed unwanted keys and only then add the key we want

PS. also solved a unneeded noqa

How should this be tested?

Manual tests:

  1. In AWX/AAP manually add execute rights to dummy_template for the dummy-team.
  2. Add to controller_roles: {"role": "execute", "team": "dummy-team", "job_templates": ["dummy_template"]}
  3. Run a playbook to include diff and dispatch roles (with present_state: true)

Before this PR the execute role would be removed (even though it's defined in config) from the team.
After this, the role is created/saved as expected

Is there a relevant Issue open for this?

Other Relevant info, PRs, etc

Add new/updated key to dict only after removing old ones
Copy link
Collaborator

@sean-m-sullivan sean-m-sullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, makes sense, thanks for the contribution!

@sean-m-sullivan sean-m-sullivan merged commit bc6e8e5 into redhat-cop:devel Nov 1, 2023
13 checks passed
przemkalit pushed a commit to przemkalit/aap_configuration that referenced this pull request Nov 22, 2024
Add new/updated key to dict only after removing old ones

Co-authored-by: Marges, RSY (Rick) <rick.marges@achmea.nl>
Co-authored-by: Sean Sullivan <ssulliva@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants