[Role] az role assignment delete: If --ids is provided, ignore other arguments, instead of raising error - #24362
Merged
Merged
Conversation
Comment on lines
+343
to
+344
| self.cmd('role assignment delete --ids {id} ' | ||
| '--assignee test --role test --resource-group test --scope test --include-inherit') |
Contributor
Author
There was a problem hiding this comment.
Will refine the test after #24324 is merged.
Comment on lines
+498
to
+502
| ids_override_args = ['assignee', 'role', 'resource_group_name', 'scope', 'include_inherited'] | ||
| for arg in ids_override_args: | ||
| if locals()[arg]: | ||
| logger.warning("option '%s' will be ignored due to use of '--ids'.", | ||
| cmd.arguments[arg].type.settings['options_list'][0]) |
Contributor
Author
There was a problem hiding this comment.
This mimics the behavior of core for --ids handling:
azure-cli/src/azure-cli-core/azure/cli/core/commands/arm.py
Lines 265 to 268 in ce3a1f1
A difference is that core doesn't show warning if default value is used, but we do here. I feel being explicit is better than being implicit.
Collaborator
|
Role |
Jiashuo Li (jiasli)
marked this pull request as ready for review
October 27, 2022 05:47
Jiashuo Li (jiasli)
requested review from
Zhiyi Huang (calvinhzy) and
Yishi Wang (evelyn-ys)
as code owners
October 27, 2022 05:47
Zhiyi Huang (calvinhzy)
approved these changes
Oct 27, 2022
Yishi Wang (evelyn-ys)
approved these changes
Oct 27, 2022
avgale
pushed a commit
to avgale/azure-cli
that referenced
this pull request
Aug 24, 2023
…her arguments, instead of raising error (Azure#24362)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix IcM 341728422
Related command
az role assignment deleteDescription
If
defaults.groupconfig option is set via:az role assignment delete --idsfails:Root Cause
This command disallows using
--idswith other arguments:azure-cli/src/azure-cli/azure/cli/command_modules/role/custom.py
Lines 497 to 499 in 98f7865
Argument
resource_group_nameis registered atazure-cli/src/azure-cli-core/azure/cli/core/__init__.py
Line 492 in d5271c3
resource_group_name_typehas aconfigured_default:azure-cli/src/azure-cli-core/azure/cli/core/commands/parameters.py
Line 242 in fa2a2d8
When
defaults.groupconfig option is set,resource_group_namevariable will be populated, causing this failure.Proposed solution
Removing the configured default value for
--resource-groupinaz role assignment deletewill be a BREAKING CHANGE and will break customers who rely on--resource-group's configured default value.Therefore, this PR changes the behavior so that if
--idsis provided, it ignores other arguments, instead of raising error.Testing Guide