-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add compatible logic for the track 2 migration of resource #3355
Conversation
a23819a
to
3d4319c
Compare
Since part of the
|
src/service_name.json
Outdated
@@ -368,5 +368,10 @@ | |||
"Command": "az webpubsub", | |||
"AzureServiceName": "Azure Web PubSub", | |||
"URL": "" | |||
}, | |||
{ | |||
"Command": "az sql", |
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.
follow alphabetical order
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 catch! OK
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.
It seems that there is no test run in live mode?
6adfea2
to
3ef11a4
Compare
try: | ||
resourceClient.resource_groups.create_or_update(resource_group_name, resource_group_params) | ||
resourceClient.resource_groups.create_or_update(resource_group_name, parameters) |
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.
We are also using the resourceClient here:
providerDetails = resourceClient.providers.get('Microsoft.Kubernetes') |
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.
Thanks for your reminder~ In fact, I know it. However, there is no breaking change for this operation (code link), so no additional compatibility logic is required.
@@ -201,9 +201,11 @@ def create_connectedk8s(cmd, client, resource_group_name, cluster_name, https_pr | |||
|
|||
# Resource group Creation | |||
if resource_group_exists(cmd.cli_ctx, resource_group_name, subscription_id) is False: | |||
resource_group_params = {'location': location} | |||
from azure.cli.core.profiles import ResourceType | |||
ResourceGroup = cmd.get_models('ResourceGroup', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) |
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.
There is another place where we use ResourceType.MGMT_RESOURCE_RESOURCES.
groups = cf_resource_groups(ctx, subscription_id=subscription_id) |
imported from:
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, |
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.
Yes, I know it. However, there is no breaking change in this logic, so no additional compatibility logic is required.
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.
For the breaking changes in the new azure-mgmt-resource
SDK, please refer to the description of PR Azure/azure-cli#17783
Yes, because most of the modified modules are not owned by us. Some live tests will fail due to non resource SDK reasons (such as some fixed resources cannot be found or do not have resource permissions), and some of the cases are not covered. |
3ef11a4
to
805f5c3
Compare
src/k8s-extension/setup.py
Outdated
@@ -32,7 +32,7 @@ | |||
# TODO: Add any additional SDK dependencies here | |||
DEPENDENCIES = [] | |||
|
|||
VERSION = "0.3.1" | |||
VERSION = "0.3.2" |
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.
We have another version coming out 0.4.0 so depending on when this goes in, this version might need to be changed
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.
OK, may I ask what is your expected version here?
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 should now be 0.4.1
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.
Yes, it has been updated
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.
Small comment on versioning
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.
For the aks -preview part, looks good to me.
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.
Please hold this as a call is failing
if validate: | ||
return smc.validate(resource_group_name, deployment_name, properties) | ||
return sdk_no_wait(no_wait, smc.create_or_update, resource_group_name, deployment_name, properties) | ||
return sdk_no_wait(no_wait, smc.begin_create_or_update, resource_group_name, deployment_name, deployment) |
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 call in begin_create_or_update
is failing. It is coming with ERROR: 'DeploymentsOperations' object has no attribute 'begin_create_or_update'
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.
As the upgrade of azure-mgmt-resource
in CLI main repo has not been released, it can only be tested through the dev environment. So may I ask if you are using CLI in dev environment and pulled the latest code from remote dev branch?
The expected version of azure-mgmt-resource
is 16.1.0
, please execute pip list
to confirm whether the version is correct~
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.
@jonathan-innis May I ask can you pass the test now?
d90cf7e
to
7e8783c
Compare
7e8783c
to
26ed2d2
Compare
As I have communicated with @jeffj6123, module |
Because Python SDK used by resource module needs to be migrated to track 2 recently, there are a lot of breaking changes in track 2, while the Python SDK of
azure-mgmt-resource
used byazure-cli-extension
is the same asazure-cli
. Therefore, the modules that use Python SDK ofazure-mgmt-resource
inazure-cli-extension
should be added with the compatible logic of track 2.Please refer to the PR description Azure/azure-cli#17783 for specific compatibility logic to be added
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
azdev style <YOUR_EXT>
locally? (pip install azdev
required)python scripts/ci/test_index.py -q
locally?For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update
src/index.json
automatically.The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify
src/index.json
.