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

azure_rm_roleassignment bugfix #464

Merged

Conversation

paultaiton
Copy link
Contributor

SUMMARY

Fixes #460

The idempotence check of matching scope + role_definition_id + assignee_object_id will now correctly interpret the different forms of role_definition_id as being equivalent. This was fixed by disregarding everything else but the guid for comparison. Since guids are not supposed to be re-used in different contexts, this should be fine.

Also corrected the problems with the ansible-test integration azure_rm_roleassignment, which should now function on any resource group that is used strictly for ansible integration tests.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

azure_rm_roleassignment
azure_rm_roleassignment_info

ADDITIONAL INFORMATION

The Azure API always returns role assignment results with a role_definition_id that is the fully qualified form. There are other ways of abbreviating this ID, which means you can have different forms that are equivalent. This was the cause of bug #460 .


@paultaiton paultaiton changed the title pushing fixes. azure_rm_roleassignment bugfix Mar 22, 2021
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

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

Please!

plugins/modules/azure_rm_roleassignment.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_roleassignment.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_roleassignment.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_roleassignment_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_roleassignment_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_roleassignment_info.py Outdated Show resolved Hide resolved
@Fred-sun Fred-sun added medium_priority Medium priority work in In trying to solve, or in working with contributors labels Mar 22, 2021
@paultaiton
Copy link
Contributor Author

Please!

Dang linter broke again. I think I've got it fixed now, hopefully this won't come up again.
Thanks @Fred-sun

@paultaiton
Copy link
Contributor Author

@Fred-sun ,
I wanted to check in with you. Is there anything else required from me at this time regarding this PR?

@Fred-sun
Copy link
Collaborator

Fred-sun commented Apr 6, 2021

@Fred-sun ,
I wanted to check in with you. Is there anything else required from me at this time regarding this PR?

Your test case failed. Can you share your test results? Thank you very much!

@paultaiton
Copy link
Contributor Author

@Fred-sun ,
I wanted to check in with you. Is there anything else required from me at this time regarding this PR?

Your test case failed. Can you share your test results? Thank you very much!

I'm not sure what you mean by share test results. I run ansible-test integration azure_rm_roleassignment --allow-destructive --allow-unsupported -v from the root of the collection, and it executes all of the tests, without failure on my machine.

If you're wanting a full dump of the output, it's quite a lot, and I'm not sure what private / secret information may be exposed, so I'm not comfortable copy/pasting it. Did you have a specific question? It should be too much trouble for me to sanitize the output of one or two tasks.

Can you share what the failure message is that you're getting? I did make some assumptions about what permissions would be available to the testing user. In my azure environment, the service principal I'm running tests under has Owner role at the scope of the two Resource Groups set up in the cloud-config-azure.ini file, which may not hold true for your test environment.

loop:
- name: "{{ az_role_assignments.roleassignments[0].name }}"
scope: "{{ az_role_assignments.roleassignments[0].scope }}"
- assignee: "{{ az_role_assignments.roleassignments[0].principal_id }}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@paultaiton If get role assignments info by assignee, scope and role_definition_id, It will return role assignments more than one! It will lead line 31 fail! Thank you very much!

Copy link
Contributor Author

@paultaiton paultaiton Apr 6, 2021

Choose a reason for hiding this comment

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

@paultaiton If get role assignments info by assignee, scope and role_definition_id, It will return role assignments more than one! It will lead line 31 fail! Thank you very much!

That was a bug that was legitimately caught by the test. I reordered the main 'module_exec' case in info module, but didn't add the assignee filter to the case that catches the assignment triplet. I just added it in latest commit, so test should pass now.

Thanks @Fred-sun

@Fred-sun
Copy link
Collaborator

Fred-sun commented Apr 7, 2021

@paultaiton Thanks for your update! I will recheck it!

@paultaiton
Copy link
Contributor Author

@paultaiton Thanks for your update! I will recheck it!

Howdy @Fred-sun
Has there been any update on this?

Thanks

@paultaiton
Copy link
Contributor Author

@Fred-sun this PR has been idle for a while, can I get an update on the review status? Is there anything else I need to modify to push this along?

@Fred-sun
Copy link
Collaborator

@Fred-sun this PR has been idle for a while, can I get an update on the review status? Is there anything else I need to modify to push this along?

I am working in this! Thank you very much!

@Fred-sun Fred-sun added ready_for_review The PR has been modified and can be reviewed and merged and removed work in In trying to solve, or in working with contributors labels May 30, 2021
@paultaiton
Copy link
Contributor Author

Howdy @Fred-sun
Can I get an update on this PR? It's been almost a couple months since the last comment.

@Fred-sun
Copy link
Collaborator

Howdy @Fred-sun
Can I get an update on this PR? It's been almost a couple months since the last comment.

This PR is waiting to be merged. Recently, because the developers are busy with other things, they did not merge immediately. I will ask them to help me merge as soon as possible. Thank you very much!

@xuzhang3
Copy link
Collaborator

LGTM

@xuzhang3 xuzhang3 merged commit 235c564 into ansible-collections:dev Jul 16, 2021
@paultaiton paultaiton deleted the paultaiton_20210319-roleassignment branch July 16, 2021 16:23
@paultaiton
Copy link
Contributor Author

Thanks @xuzhang3

Fred-sun added a commit to Fred-sun/ansible_collections_azure that referenced this pull request Aug 11, 2021
* add new paramter node_labels for agent_pool

* remove space

Add return value for azure_rm_containerregistry idempotent test (ansible-collections#578)

* Add return value for azure_rm_containerregistry idempotent test

* fix sanity error:

* remove require set

azure_rm_roleassignment bugfix (ansible-collections#464)

* pushing fixes.

* whitespace

* whitespace

* Update aliases

* add assignee filter to triplet lookup

Co-authored-by: Fred-sun <[email protected]>

azure_rm_aks: support system-assigned (managed) identity, (ansible-collections#514)

* azure_rm_aks: make linux_profile and service_principal optional, support system-assigned (managed) identity

* azure_rm_aks: adjust docs formatting

Co-authored-by: Fred-sun <[email protected]>

* azure_rm_aks: add a test for the minimal parameters cluster definition

* azure_rm_aks: fix sanity-checks / pep8 requirements

* Add instructions for tests / sanity checks

Co-authored-by: Fred-sun <[email protected]>

Upddate test case (ansible-collections#585)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azure_rm_roleassignment fails on additional runs
3 participants