Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Migrate RP from Azure AD Graph to Microsoft Graph #1970
Migrate RP from Azure AD Graph to Microsoft Graph #1970
Changes from 1 commit
5125f08
8729401
25fee28
e9765db
96d3a73
b9e878c
6de830a
bcb2cb9
7257d6c
5af68ff
dd4f4a6
643ff9e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea: Tagging this for 404 error refactors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the use case that led me to have
GetServicePrincipalIdByAppID
returnnil
for not found instead of an error.deleteRoleAssignments
is idempotent, so if it can't find the app ID then it's actually a success. Checking fornil
here just seemed simpler than parsing anerror
(especially an MS Graph error), but if you still feel it should eat an error here then I can revise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit it is a stylistic choice, so I'll let others comment too - I'd hold off on the change and see what others think. IMO, if we have 1 case where a "not found" is expected, and all others without, we could do a specific error handling check on that 1 case to achieve the same result (if the error is a
404
error, then...). This would save us from refactoring all cases.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, however, there's only 3 cases total. 🙂 But I'm willing to go either way based on consensus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am in favor of not using nil as a 'happy path' value when we can't find the service principal when given an appId this should be an error (handled) but not expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't return an error, but log a message stating no role assignments found.
If the cluster installation fails or is requeued for any reason, this role assignment may not exist. And that's totally fine, we're just trying to clean up after ourselves on cluster deletion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not consider this as an error either. There simply are not roleAssignments to delete. +1 on logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this discussion thread shifted slightly.
Originally we were debating whether
GetServicePrincipalIDByAppID
should return an error if no service principals are found. It was a stylistic choice on my part to just return anil
string pointer.What I'm understanding from the last couple comments is a "not found" error from
c.roleassignments.ListForResourceGroup
should simply be logged? (If it even returns an error in that case, I'm not sure if it does.) I'll investigate and open a followup PR if necessary, if that's alright.