-
Notifications
You must be signed in to change notification settings - Fork 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 management groups commands to azure-cli-resource #6426
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 |
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.
To transition from an extension to being in the CLI, a command review is required. Please reach out to schedule.
@@ -3,6 +3,10 @@ | |||
Release History | |||
=============== | |||
|
|||
2.0.30 | |||
++++++ | |||
* Add management-group commands |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok will make this change. Also, just checked the travis build. Will make the changes.
@@ -33,7 +33,8 @@ | |||
DEPENDENCIES = [ | |||
'azure-mgmt-resource==1.2.1', | |||
'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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That's right.
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.
Summary of changes we discussed during the review:
- all examples need to be updated
- remove
--group-name
and just use--name
-
--parent-id
should be just--parent
and accept the name or ID of another management group
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.
Some feedback on certain implementation details. Didn't see anything obvious that would be not working about parent.
@@ -1077,8 +1077,119 @@ def update_policy_setdefinition(cmd, policy_set_definition_name, definitions=Non | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating a dictionary, you could just create the PatchManagementGroupRequest object 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.
Will do. Thanks!
parent=None): | ||
instance["display_name"] = display_name | ||
instance["parent"] = parent | ||
return instance |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
ebee1a0
to
385ff5d
Compare
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. |
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.
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 133 Continue 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.