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

Add Python3 CLI Commands #5415

Merged
merged 15 commits into from
Oct 25, 2022
Merged

Add Python3 CLI Commands #5415

merged 15 commits into from
Oct 25, 2022

Conversation

sushil490023
Copy link
Contributor

@sushil490023 sushil490023 commented Oct 4, 2022


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run 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 pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
The precondition is to put your code inside this repository and upgrade the version in the pull request but do not modify src/index.json.

@ghost
Copy link

ghost commented Oct 4, 2022

Thank you for your contribution sushil490023! We will review the pull request and get back to you soon.

@ghost ghost added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Oct 4, 2022
@sushil490023 sushil490023 mentioned this pull request Oct 4, 2022
3 tasks
@yonzhan
Copy link
Collaborator

yonzhan commented Oct 4, 2022

automation

@wangzelin007
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zhoxing-ms
Copy link
Contributor

@sushil490023 Could you please resolve those CI issues?

"""Retrieve the python 3 package identified by package name.

:example: Get Python3Package by Name
az automation python3-package show --automation-account-name "MyAutomationAccount" --resource-group "MyResourceGroup " --name "PackageName"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
az automation python3-package show --automation-account-name "MyAutomationAccount" --resource-group "MyResourceGroup " --name "PackageName"
az automation python3-package show --automation-account-name "MyAutomationAccount" --resource-group "MyResourceGroup" --name "PackageName"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed spaces Thanks for pointing out

@wangzelin007
Copy link
Member

@sushil490023,
What is the difference between python3_package and python3package directories?
Actually I compare the two directories and they use almost the same code.
image

@wangzelin007
Copy link
Member

@sushil490023,
May I ask if these example codes are automatically generated by codegen?
If these extra blanks are caused by codegen, we should let @kairu-ms known about this.
image

@kairu-ms
Copy link
Contributor

kairu-ms commented Oct 9, 2022

@sushil490023, May I ask if these example codes are automatically generated by codegen? If these extra blanks are caused by codegen, we should let @kairu-ms known about this. image

Examples are manually written in Workspace Editors right now.

@sushil490023
Copy link
Contributor Author

@sushil490023, What is the difference between python3_package and python3package directories? Actually I compare the two directories and they use almost the same code. image

I have deleted python3package directories

@zhoxing-ms
Copy link
Contributor

vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/automation/azext_automation/tests/latest/recordings/test_automation_software_update_configuration.yaml') in your current record mode ('once').
No match for the request (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/publishers/Canonical/artifacttypes/vmimage/offers/UbuntuServer/skus/18.04-LTS/versions?$top=1&$orderby=name%20desc&api-version=2022-08-01>) was found.
Found 1 similar requests with 1 different matcher(s) :

1 - (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus/publishers/Canonical/artifacttypes/vmimage/offers/UbuntuServer/skus/18.04-LTS/versions?$top=1&$orderby=name%20desc&api-version=2022-03-01>).
Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
Matchers failed :
_custom_request_query_matcher - assertion failure :
None

@sushil490023 This is because the api-version of Compute RP in azure-cli-core has been upgraded (PR link: Azure/azure-cli#24036), so you need to re-record the tests related to Compute RP in the extension.

Please pull the latest main CLI code from the dev branch of Azure/azure-cli repo first, and re-record those failed tests locally and then pushing them into this PR

"""Create or Update the python 3 package identified by package name.

:example: Add Python3 Package to automation account
az automation python3-package create --automation-account-name "MyAutomationAccount" --resource-group "MyResourceGroup" --name "PackageName" --content-link "uri=https://PackageUri.com"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
az automation python3-package create --automation-account-name "MyAutomationAccount" --resource-group "MyResourceGroup" --name "PackageName" --content-link "uri=https://PackageUri.com"
az automation python3-package create --automation-account-name "MyAutomationAccount" --resource-group "MyResourceGroup" --name "PackageName" --content-link "uri=https://PackageUri.com"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment on lines 18 to 19
"""Get a hybrid runbook worker group.
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that examples have been added to commands under automation hrwg hrw group, but there still seems to be no examples for commands under automation hrwg group

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have added required examples

@zhoxing-ms
Copy link
Contributor

Please add the description of PR changes in the HISTORY.rst. And if you want to release a new extension version for this PR, please also upgrade the version defined in setup.py.

@sushil490023
Copy link
Contributor Author

Please add the description of PR changes in the HISTORY.rst. And if you want to release a new extension version for this PR, please also upgrade the version defined in setup.py.

Updated

@@ -3,6 +3,10 @@
Release History
===============

0.2.1
++++++
* `az automation python3-package`: Add new command group to support managing python3 Package operations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `az automation python3-package`: Add new command group to support managing python3 Package operations.
* `az automation python3-package`: Add new command group to support managing python3 package operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"""Delete a hybrid runbook worker group.

:example: Delete hybrid worker group
az automation hrwg delete --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
az automation hrwg delete --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName
az automation hrwg delete --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName

"""Get hybrid worker group

:example: Get hybrid worker group
az automation hrwg show --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
az automation hrwg show --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName
az automation hrwg show --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

"""Update a hybrid runbook worker group.

:example: Update hybrid worker group
az automation hrwg update --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName --credential "{name: credentialname}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
az automation hrwg update --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName --credential "{name: credentialname}"
az automation hrwg update --automation-account-name accountName --resource-group groupName --name hybridrunbookworkergroupName --credential "{name: credentialname}"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Contributor

@zhoxing-ms zhoxing-ms Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kairu-ms I find it is easy to mistype extra spaces when he enters examples by Workspace Editors.
I'm not sure if this is a common problem. If so, could we trim the user's input to eliminate the extra spaces in Workspace Editors?

Copy link
Contributor

@kairu-ms kairu-ms Oct 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a new task in CodeGen V2 project plan. We will fix it when work on examples validation.

@wangzelin007
Copy link
Member

wangzelin007 commented Oct 21, 2022

@sushil490023,
May I ask you to add some scenario tests for those new commands?

  • az automation hrwg update
  • az automation hrwg hrw create/delete/show/update

@sushil490023
Copy link
Contributor Author

sushil490023 commented Oct 21, 2022

@microsoft-github-policy-service agree [company="Microsoft"]

1 similar comment
@sushil490023
Copy link
Contributor Author

@microsoft-github-policy-service agree [company="Microsoft"]

@wangzelin007
Copy link
Member

@microsoft-github-policy-service agree company="Microsoft"

@zhoxing-ms
Copy link
Contributor

zhoxing-ms commented Oct 21, 2022

May I ask you to add some scenario tests for those new commands?

az automation hrwg update
az automation hrwg hrw create/delete/show/update

@sushil490023 Since these commands are existing commands, you may can consider submitting a PR separately to supplement these test cases. So we can merge the PR first, and then review the PR for supplementing test cases. What do you think of it?

@sushil490023
Copy link
Contributor Author

May I ask you to add some scenario tests for those new commands?

az automation hrwg update
az automation hrwg hrw create/delete/show/update

@sushil490023 Since these commands are existing commands, you may can consider submitting a PR separately to supplement these test cases. So we can merge the PR first, and then review the PR for supplementing test cases. What do you think of it?

Yes i think that would be much helpful and i will create sperate PR for adding scenario test cases for left over test cases of Hybrid runbook worker

@sushil490023
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Microsoft"

@wangzelin007
Copy link
Member

@microsoft-github-policy-service agree

@Azure Azure deleted a comment from azure-pipelines bot Oct 21, 2022
@wangzelin007 wangzelin007 reopened this Oct 21, 2022
@wangzelin007
Copy link
Member

Force skip license/cla checks to merge this PR.
@sushil490023,
I think you still need to fix the account issue, otherwise every PR of yours will have to force skip checks to merge.

@wangzelin007 wangzelin007 merged commit d855cc2 into Azure:main Oct 25, 2022
@azclibot
Copy link
Collaborator

[Release] Update index.json for extension [ automation ] : https://dev.azure.com/azclitools/internal/_build/results?buildId=11062&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants