-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{ARM} Bump azure-mgmt-resource SDK from 10.1.0 to 10.2.0 #14678
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
{ARM} Bump azure-mgmt-resource SDK from 10.1.0 to 10.2.0 #14678
Conversation
…e stamp added to deployment_name, excess file removed in commit, launch,json reverted
|
ping @eladperets @zhoxing-ms |
|
ARM |
| from azure.cli.core.parser import IncorrectUsageError | ||
| raise IncorrectUsageError('Resource type {} not found.'.format(resource_type_str)) | ||
| try: | ||
| # if the service specifies, use the default API version |
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 change should be reviewed by more folks.
| # single API version. API versions are returned by the service in a sorted list | ||
| # Use the most recent non-preview API version unless there is only a | ||
| # single API version. API versions are returned by the service in a sorted list. | ||
| api_version = next((x for x in rt.api_versions if not x.endswith('preview')), rt.api_versions[0]) |
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.
With such change, if the rp only has preview api versions, it will get an exception because you only try to get latest stable api version. But in previous design if the default version is preview version, it still can get an preview api version.
I will prefer preview api version could be an backup in such scenario.
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.
Yeah, but in fact this is how the current logic is implemented. When (x for x in rt.api_versions if not x.endswith('preview')) cannot get a value, next() will take rt.api_versions[0], and rt.api_versions[0] is the latest preview api-version.
arrownj
left a comment
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.
Does this change has impacts to extensions which import resource SDK ?
@arrownj There should be no impact, because this version of SDK only returns more fields, but does not affect the original logic. |
jsntcy
left a comment
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.
![]()
Description
Bump azure-mgmt-resource from 10.1.0 to 10.2.0
For PR: #14448
Cause of the problem
The method
provider = client.providers.get(namespace)is called to retrieve the api-version list of all the ResourceTypes in the specified namespace. Whether the return value of theProviderResourceTypein the api-version list contains thedefault_api_versionfield will affect the api-version fetch logic:default_api_versionfield is not included in theProviderResourceTypereturned by the older version before10.2.0of SDK, so the latest api-version will be taken (stable version is preferred).10.2.0returns thedefault_api_versioninProviderResourceType, so the logic to fetch api-version has changed, the value ofdefault_api_versionwill be used directly.Fix getting resource API version in ARM cmdlt: @eladperets
Latest swagger updates added the 'defaultApiVersion' property to the GET resource providers response.
The old code was trying to use the default API version and only than fall back to the API versions specified in the manifest.
This was wrong because:
This change addresses this issue.
Testing Guide
History Notes