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

Bump azure-mgmt-resource to Track 2 15.0.0 #15530

Closed
jiasli opened this issue Oct 15, 2020 · 10 comments
Closed

Bump azure-mgmt-resource to Track 2 15.0.0 #15530

jiasli opened this issue Oct 15, 2020 · 10 comments
Assignees
Labels
Core CLI core infrastructure feature-request
Milestone

Comments

@jiasli
Copy link
Member

jiasli commented Oct 15, 2020

Is your feature request related to a problem? Please describe.

Due to the code change in Track 2 SDK, if a user uses pip to install Azure CLI and azure-mgmt-resource==15.0.0 in the same virtual environment. CLI will stop functioning correctly:

> az login
...
AttributeError: 'SubscriptionClient' object has no attribute 'config'

More info: #13995

Describe the solution you'd like

Bump the dependency of azure-mgmt-resource to Track 2 15.0.0.

Describe alternatives you've considered

Install Azure CLI and azure-mgmt-resource==15.0.0 in separate environments.

Additional context

See #15461, #15429, #14716, #13995, #15460, #13995.

@ghost ghost added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Oct 15, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Oct 15, 2020

Bump azure-mgmt-resource

@yonzhan yonzhan added the Core CLI core infrastructure label Oct 15, 2020
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Oct 15, 2020
@yonzhan yonzhan added this to the S178 milestone Oct 15, 2020
@glaubitz
Copy link

Is there any preliminary patch for this issue yet?

@jiasli
Copy link
Member Author

jiasli commented Nov 12, 2020

We are currently working on it, but this migration requires huge amount of effort.

We will vendor a subscription SDK in azure-cli-core temporarily (#15711) in the next sprint so that azure-cli-core doesn't have hard dependency on azure-mgmt-resource, but the migration on command modules will take several sprints.

Thank you for you understanding.

@glaubitz
Copy link

OK, thanks a lot for the explanation. I understand the necessary effort, I just wanted to get a rough estimate so that we can inform our users at SUSE.

Thanks!

@yonzhan yonzhan modified the milestones: S178, S180, S181 Nov 14, 2020
@yonzhan yonzhan modified the milestones: S181, S182 Dec 5, 2020
@yonzhan yonzhan modified the milestones: S182, S183 Jan 7, 2021
@glaubitz
Copy link

It seems that there is another incompatibility with azure-mgmt-resource with azure-cli-core:

glaubitz@suse-laptop:~> az resource delete adriantest
UnrecognizedArgumentError: unrecognized arguments: adriantest
Try this: 'az resource delete --ids </subscriptions/0b1f6471-1bf0-4dda-aec3-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/MyWebapp>'
Still stuck? Run 'az --help' to view all commands or go to 'https://aka.ms/cli_ref' to learn more
glaubitz@suse-laptop:~> az group delete --name adriantest
CLIInternalError: The command failed with an unexpected error. Here is the traceback:
The operation 'azure.mgmt.resource.resources.v2020_06_01.operations#ResourceGroupsOperations.delete' is invalid.
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 829, in get_op_handler
    op = getattr(op, part)
AttributeError: type object 'ResourceGroupsOperations' has no attribute 'delete'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/knack/cli.py", line 215, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 558, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 478, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
  File "/usr/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 315, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/usr/lib/python3.8/site-packages/knack/commands.py", line 106, in load_arguments
    cmd_args = self.arguments_loader()
  File "/usr/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 787, in default_arguments_loader
    op = handler or self.get_op_handler(operation, operation_group=kwargs.get('operation_group'))
  File "/usr/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 834, in get_op_handler
    raise ValueError("The operation '{}' is invalid.".format(operation))
ValueError: The operation 'azure.mgmt.resource.resources.v2020_06_01.operations#ResourceGroupsOperations.delete' is invalid.
To open an issue, please run: 'az feedback'

@glaubitz
Copy link

I can confirm that downgrading azure-mgmt-resource to version 10.3.0 fixes the problem for me.

So, it seems that the subscription module isn't the only module affected by the API change in azure-mgmt-resource.

@zhoxing-ms
Copy link
Contributor

zhoxing-ms commented Jan 14, 2021

@glaubitz Yes, the resource module will also be affected because it is not compatible with the Track 2 SDK.
In Track2 SDK (azure-mgmt-resource>=15.0.0), the name of method delete is changed to begin_delete, which leads to the error of type object 'ResourceGroupsOperations' has no attribute 'delete'. code link

@glaubitz
Copy link

I assume you mean, the resource module will be compatible again since currently it is not which causes the errors in resource and subscription modules in Azure CLI.

@yonzhan yonzhan modified the milestones: S185, S186 Apr 10, 2021
@yonzhan yonzhan closed this as completed Apr 30, 2021
@glaubitz
Copy link

Has this fix already been released?

@zhoxing-ms
Copy link
Contributor

@glaubitz Hi, there is a PR that is upgrading azure-mgmt-resource from 12.1.0 to 16.1.0
PR link: #17783
It will be released in this sprint(2021-05-25)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core CLI core infrastructure feature-request
Projects
None yet
Development

No branches or pull requests

5 participants