Add management groups commands to azure-cli-resource#6426
Add management groups commands to azure-cli-resource#6426tjprescott merged 13 commits intoAzure:devfrom rajshah11:cli-mgmt-grp
Conversation
|
View a preview at https://prompt.ws/r/Azure/azure-cli/6426 |
|
The SDK is in PR Azure/azure-sdk-for-python#2520. I have tested by downloading the wheel into the "privates" folder. The SDK will be merged and release once this PR is given a thumbs up. Adding @lmazuel |
tjprescott
left a comment
There was a problem hiding this comment.
To transition from an extension to being in the CLI, a command review is required. Please reach out to schedule.
|
|
||
| 2.0.30 | ||
| ++++++ | ||
| * Add management-group commands |
There was a problem hiding this comment.
This needs to be more explicit especially since these commands live in the command tree that is predominantly in a different module.
"* add account management-group commands."
There was a problem hiding this comment.
Ok will make this change. Also, just checked the travis build. Will make the changes.
| 'azure-cli-core', | ||
| 'azure-mgmt-authorization==0.40.0' | ||
| 'azure-mgmt-authorization==0.40.0', | ||
| 'azure-mgmt-managementgroups==2018-03-01-preview' |
There was a problem hiding this comment.
Just to be sure we're on the same page 2018-03-01-preview is a temporary version picked by the SDK CI, actual final version will be 0.1.0.
So once we're done here, final step will be:
- I release the SDK as 0.1.0 on PyPI
- You do a last commit here that removes the "privates" folder, and change this line to 0.1.0
There was a problem hiding this comment.
Yes. That's right.
tjprescott
left a comment
There was a problem hiding this comment.
Summary of changes we discussed during the review:
- all examples need to be updated
- remove
--group-nameand just use--name -
--parent-idshould be just--parentand accept the name or ID of another management group
tjprescott
left a comment
There was a problem hiding this comment.
Some feedback on certain implementation details. Didn't see anything obvious that would be not working about parent.
| return policy_client.policy_set_definitions.create_or_update(policy_set_definition_name, parameters) | ||
|
|
||
|
|
||
| def _register_rp(cli_ctx, subscription_id=None): |
There was a problem hiding this comment.
Why is this in here? @yugangw-msft @lmazuel correct me if I'm wrong but msrest will automatically handle this, correct?
There was a problem hiding this comment.
You can look at the discussion here - Azure/azure-cli-extensions#62. Not sure if the issue has been resolved.
|
|
||
| def cli_managementgroups_group_update_get(): | ||
| update_parameters = {'display_name': None, 'parent': None} | ||
| return update_parameters |
There was a problem hiding this comment.
Instead of creating a dictionary, you could just create the PatchManagementGroupRequest object here.
| parent=None): | ||
| instance["display_name"] = display_name | ||
| instance["parent"] = parent | ||
| return instance |
There was a problem hiding this comment.
If the instance is the object, these simply become instance.foo = foo. A little cleaner.
| parent_id=_get_parent_id_from_parent(parameters["parent"]) | ||
| from azure.mgmt.managementgroups.models import PatchManagementGroupRequest | ||
| patch_mgmt_grp_request = PatchManagementGroupRequest(display_name=parameters["display_name"], parent_id=parent_id) | ||
| return client.update(group_name, patch_mgmt_grp_request) |
There was a problem hiding this comment.
This could be made cleaner:
def cli_managmentgroups_group_update_set(…):
return client.update(group_name, parameters)|
@rajshah11 the sprint 38 will close by the end of tomorrow. Please make sure this PR is merged by then. |
|
I have made all the suggested changes and fixed some of the build errors. However, there are still a few errors. Can someone please look into this build and assist me in removing those errors - https://travis-ci.org/Azure/azure-cli/builds/385959671?utm_source=github_status&utm_medium=notification? Firstly, I am getting an error saying Also, the automation tests are failing but the tests run properly on my machine. |
tjprescott
left a comment
There was a problem hiding this comment.
Two things:
- Add logic to suppress the old extension. https://github.com/Azure/azure-cli/blob/dev/doc/authoring_command_modules/authoring_commands.md#extension-suppression
- Remove private WHL
Codecov Report
@@ Coverage Diff @@
## dev #6426 +/- ##
===================================
Coverage 0% 0%
===================================
Files 11 11
Lines 133 133
Branches 9 9
===================================
Misses 133 133Continue to review full report at Codecov.
|
|
Also please make sure you are running |
| helps['account management-group create'] = """ | ||
| type: command | ||
| short-summary: Create a new management group. | ||
| long-summary: Create a new management group. |
There was a problem hiding this comment.
long-summary should provide additional information, instead of being a duplicate of short-summary.
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR has modified HISTORY.rst describing any customer-facing, functional changes. Note that this does not include changes only to help content. (see Modifying change log).
I adhere to the Command Guidelines.