-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Role] BREAKING CHANGE: az role assignment create: --scope is now a required argument
#27651
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,11 +84,13 @@ def process_assignment_namespace(cmd, namespace): # pylint: disable=unused-argu | |
| non_empty_msg = "usage error: {} can't be an empty string. Either omit it or provide a non-empty string." | ||
|
|
||
| for arg in non_empty_args: | ||
| if getattr(namespace, arg) == "": | ||
| if getattr(namespace, arg, None) == "": | ||
| # Get option name, like resource_group_name -> --resource-group | ||
| option_name = cmd.arguments[arg].type.settings['options_list'][0] | ||
| raise CLIError(non_empty_msg.format(option_name)) | ||
|
|
||
| resource_group = namespace.resource_group_name | ||
| if namespace.scope and resource_group and getattr(resource_group, 'is_default', None): | ||
| namespace.resource_group_name = None # drop configured defaults | ||
| # `az role assignment create` doesn't support resource_group_name | ||
| if hasattr(namespace, "resource_group_name"): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can mention removing
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch! Added to the History Notes section. |
||
| resource_group = namespace.resource_group_name | ||
| if namespace.scope and resource_group and getattr(resource_group, 'is_default', None): | ||
| namespace.resource_group_name = None # drop configured defaults | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Is there any reason to add the default value for
getattr, is there any difference betweenscopeand othernon_empty_args?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.
Good question. After removing
resource_group_namefromaz role assignment create,resource_group_namewill not exist innamespace. If we don't add a default value here,getattrwill fail forresource_group_nameunderaz role assignment create.