Hello community,
here is the log from the commit of package azure-cli-resource for
openSUSE:Factory checked in at 2018-10-15 10:48:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/azure-cli-resource (Old)
and /work/SRC/openSUSE:Factory/.azure-cli-resource.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "azure-cli-resource"
Mon Oct 15 10:48:01 2018 rev:4 rq:641230 version:2.1.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/azure-cli-resource/azure-cli-resource.changes
2018-05-13 16:03:08.754532847 +0200
+++
/work/SRC/openSUSE:Factory/.azure-cli-resource.new/azure-cli-resource.changes
2018-10-15 10:48:01.947095820 +0200
@@ -1,0 +2,9 @@
+Mon Sep 17 14:08:12 UTC 2018 - John Paul Adrian Glaubitz
<[email protected]>
+
+- New upstream release
+ + Version 2.1.3
+ + For detailed information about changes see the
+ HISTORY.txt file provided with this package
+- Update Requires from setup.py
+
+-------------------------------------------------------------------
Old:
----
azure-cli-resource-2.0.27.tar.gz
New:
----
azure-cli-resource-2.1.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ azure-cli-resource.spec ++++++
--- /var/tmp/diff_new_pack.JyEAUi/_old 2018-10-15 10:48:02.319095422 +0200
+++ /var/tmp/diff_new_pack.JyEAUi/_new 2018-10-15 10:48:02.319095422 +0200
@@ -12,12 +12,12 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: azure-cli-resource
-Version: 2.0.27
+Version: 2.1.3
Release: 0
Summary: Microsoft Azure CLI 'resource' Command Module
License: MIT
@@ -34,8 +34,8 @@
Requires: azure-cli-command-modules-nspkg
Requires: azure-cli-core
Requires: azure-cli-nspkg
-Requires: python3-azure-mgmt-authorization >= 0.40.0
-Requires: python3-azure-mgmt-resource >= 1.2.1
+Requires: python3-azure-mgmt-authorization >= 0.50.0
+Requires: python3-azure-mgmt-managementgroups >= 0.1.0
Requires: python3-azure-nspkg
Conflicts: azure-cli < 2.0.0
++++++ azure-cli-resource-2.0.27.tar.gz -> azure-cli-resource-2.1.3.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-resource-2.0.27/HISTORY.rst
new/azure-cli-resource-2.1.3/HISTORY.rst
--- old/azure-cli-resource-2.0.27/HISTORY.rst 2018-04-06 19:33:13.000000000
+0200
+++ new/azure-cli-resource-2.1.3/HISTORY.rst 2018-08-23 01:07:57.000000000
+0200
@@ -2,6 +2,47 @@
Release History
===============
+2.1.3
++++++
+* `provider operation show`: exception handling to exit with code 3 upon a
missing resource for consistency.
+
+2.1.2
++++++
+* Minor changes
+
+2.1.1
++++++
+* `group deployment create`: Add `--rollback-on-error` to execute a known-good
deployment on error.
+* `group deployment create`: Fix issue where `--parameters {}` resulted in an
error.
+
+2.1.0
++++++
+* BREAKING CHANGE: 'show' commands log error message and fail with exit code
of 3 upon a missing resource.
+* `group deployment delete`: Add `--no-wait` support.
+* `deployment delete`: Add `--no-wait` support.
+* Added `deployment wait` command.
+* Fix issue where the subscription-level `az deployment` commands erroneously
appeared for profile 2017-03-09-profile.
+
+2.0.32
+++++++
+* Support deployment at subscription scope: new operation group `deployment`.
+
+2.0.31
+++++++
+* Minor changes
+
+2.0.30
+++++++
+* add `account management-group` commands.
+
+2.0.29
+++++++
+* Minor changes
+
+2.0.28
+++++++
+* Minor changes
+
2.0.27
++++++
* `policy definition create`: Add support for `--metadata`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-resource-2.0.27/PKG-INFO
new/azure-cli-resource-2.1.3/PKG-INFO
--- old/azure-cli-resource-2.0.27/PKG-INFO 2018-04-06 19:33:47.000000000
+0200
+++ new/azure-cli-resource-2.1.3/PKG-INFO 2018-08-23 01:09:32.000000000
+0200
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: azure-cli-resource
-Version: 2.0.27
+Version: 2.1.3
Summary: Microsoft Azure Command-Line Tools Resource Command Module
Home-page: https://github.com/Azure/azure-cli
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT
-Description-Content-Type: UNKNOWN
Description: Microsoft Azure CLI 'resource' Command Module
=============================================
@@ -20,6 +19,47 @@
Release History
===============
+ 2.1.3
+ +++++
+ * `provider operation show`: exception handling to exit with code 3
upon a missing resource for consistency.
+
+ 2.1.2
+ +++++
+ * Minor changes
+
+ 2.1.1
+ +++++
+ * `group deployment create`: Add `--rollback-on-error` to execute a
known-good deployment on error.
+ * `group deployment create`: Fix issue where `--parameters {}`
resulted in an error.
+
+ 2.1.0
+ +++++
+ * BREAKING CHANGE: 'show' commands log error message and fail with
exit code of 3 upon a missing resource.
+ * `group deployment delete`: Add `--no-wait` support.
+ * `deployment delete`: Add `--no-wait` support.
+ * Added `deployment wait` command.
+ * Fix issue where the subscription-level `az deployment` commands
erroneously appeared for profile 2017-03-09-profile.
+
+ 2.0.32
+ ++++++
+ * Support deployment at subscription scope: new operation group
`deployment`.
+
+ 2.0.31
+ ++++++
+ * Minor changes
+
+ 2.0.30
+ ++++++
+ * add `account management-group` commands.
+
+ 2.0.29
+ ++++++
+ * Minor changes
+
+ 2.0.28
+ ++++++
+ * Minor changes
+
2.0.27
++++++
* `policy definition create`: Add support for `--metadata`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/__init__.py
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/__init__.py
---
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/__init__.py
2018-04-06 19:33:13.000000000 +0200
+++ new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/__init__.py
2018-08-23 01:07:57.000000000 +0200
@@ -12,9 +12,14 @@
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
+ from azure.cli.core import ModExtensionSuppress
resource_custom =
CliCommandType(operations_tmpl='azure.cli.command_modules.resource.custom#{}')
super(ResourceCommandsLoader, self).__init__(cli_ctx=cli_ctx,
-
custom_command_type=resource_custom)
+
custom_command_type=resource_custom,
+
suppress_extension=ModExtensionSuppress(
+ __name__,
'managementgroups', '0.1.0',
+ reason='The
management groups commands are now in CLI.',
+
recommend_remove=True))
def load_command_table(self, args):
from azure.cli.command_modules.resource.commands import
load_command_table
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_client_factory.py
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_client_factory.py
---
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_client_factory.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_client_factory.py
2018-08-23 01:07:57.000000000 +0200
@@ -36,8 +36,8 @@
def _authorization_management_client(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
- from azure.mgmt.authorization import AuthorizationManagementClient
- return get_mgmt_service_client(cli_ctx, AuthorizationManagementClient)
+ from azure.cli.core.profiles import ResourceType
+ return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_AUTHORIZATION)
def _resource_managedapps_client_factory(cli_ctx, **_):
@@ -46,6 +46,12 @@
return get_mgmt_service_client(cli_ctx, ApplicationClient)
+def _resource_managementgroups_client_factory(cli_ctx, **_):
+ from azure.cli.core.commands.client_factory import get_mgmt_service_client
+ from azure.mgmt.managementgroups import ManagementGroupsAPI
+ return get_mgmt_service_client(cli_ctx, ManagementGroupsAPI,
subscription_bound=False)
+
+
def cf_resource_groups(cli_ctx, _):
return _resource_client_factory(cli_ctx).resource_groups
@@ -96,3 +102,11 @@
def cf_resource_managedappdefinitions(cli_ctx, _):
return
_resource_managedapps_client_factory(cli_ctx).application_definitions
+
+
+def cf_management_groups(cli_ctx, _):
+ return _resource_managementgroups_client_factory(cli_ctx).management_groups
+
+
+def cf_management_group_subscriptions(cli_ctx, _):
+ return
_resource_managementgroups_client_factory(cli_ctx).management_group_subscriptions
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_exception_handler.py
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_exception_handler.py
---
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_exception_handler.py
1970-01-01 01:00:00.000000000 +0100
+++
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_exception_handler.py
2018-08-23 01:07:57.000000000 +0200
@@ -0,0 +1,19 @@
+#
--------------------------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for
license information.
+#
--------------------------------------------------------------------------------------------
+
+from azure.cli.core.util import CLIError
+
+
+def managementgroups_exception_handler(ex):
+ from azure.mgmt.managementgroups.models import ErrorResponseException
+ if isinstance(ex, ErrorResponseException):
+ if ex.error.error:
+ raise CLIError(ex.error.error)
+ else:
+ raise CLIError(ex.error)
+ else:
+ import sys
+ from six import reraise
+ reraise(*sys.exc_info())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_help.py
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_help.py
--- old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_help.py
2018-04-06 19:33:13.000000000 +0200
+++ new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_help.py
2018-08-23 01:07:57.000000000 +0200
@@ -1,3 +1,4 @@
+# coding=utf-8
#
--------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
license information.
@@ -152,6 +153,155 @@
text: >
az account lock update --name lockName --notes newNotesHere
--lock-type CanNotDelete
"""
+helps['account management-group'] = """
+ type: group
+ short-summary: Manage Azure Management Groups.
+"""
+
+helps['account management-group subscription'] = """
+ type: group
+ short-summary: Subscription operations for Management Groups.
+"""
+
+helps['account management-group list'] = """
+ type: command
+ short-summary: List all management groups.
+ long-summary: List of all management groups in the current tenant.
+ examples:
+ - name: List all management groups
+ text: >
+ az account management-group list
+"""
+
+helps['account management-group show'] = """
+ type: command
+ short-summary: Get a specific management group.
+ long-summary: Get the details of the management group.
+ parameters:
+ - name: --name -n
+ type: string
+ short-summary: Name of the management group.
+ - name: --expand -e
+ type: bool
+ short-summary: If given, lists the children in the first level of
hierarchy.
+ - name: --recurse -r
+ type: bool
+ short-summary: If given, lists the children in all levels of
hierarchy.
+ examples:
+ - name: Get a management group.
+ text: >
+ az account management-group show --name GroupName
+ - name: Get a management group with children in the first level of
hierarchy.
+ text: >
+ az account management-group show --name GroupName -e
+ - name: Get a management group with children in all levels of
hierarchy.
+ text: >
+ az account management-group show --name GroupName -e -r
+"""
+
+helps['account management-group create'] = """
+ type: command
+ short-summary: Create a new management group.
+ long-summary: Create a new management group.
+ parameters:
+ - name: --name -n
+ type: string
+ short-summary: Name of the management group.
+ - name: --display-name -d
+ type: string
+ short-summary: Sets the display name of the management group. If
null, the group name is set as the display name.
+ - name: --parent -p
+ type: string
+ short-summary: Sets the parent of the management group. Can be the
fully qualified id or the name of the management group. If null, the root
tenant group is set as the parent.
+ examples:
+ - name: Create a new management group.
+ text: >
+ az account management-group create --name GroupName
+ - name: Create a new management group with a specific display name.
+ text: >
+ az account management-group create --name GroupName
--display-name DisplayName
+ - name: Create a new management group with a specific parent.
+ text: >
+ az account management-group create --name GroupName --parent
ParentId/ParentName
+ - name: Create a new management group with a specific display name and
parent.
+ text: >
+ az account management-group create --name GroupName
--display-name DisplayName --parent ParentId/ParentName
+"""
+
+helps['account management-group update'] = """
+ type: command
+ short-summary: Update an existing management group.
+ long-summary: Update an existing management group.
+ parameters:
+ - name: --name -n
+ type: string
+ short-summary: Name of the management group.
+ - name: --display-name -d
+ type: string
+ short-summary: Updates the display name of the management group. If
null, no change is made.
+ - name: --parent -p
+ type: string
+ short-summary: Update the parent of the management group. Can be the
fully qualified id or the name of the management group. If null, no change is
made.
+ examples:
+ - name: Update an existing management group with a specific display
name.
+ text: >
+ az account management-group update --name GroupName
--display-name DisplayName
+ - name: Update an existing management group with a specific parent.
+ text: >
+ az account management-group update --name GroupName --parent
ParentId/ParentName
+ - name: Update an existing management group with a specific display
name and parent.
+ text: >
+ az account management-group update --name GroupName
--display-name DisplayName --parent ParentId/ParentName
+"""
+
+helps['account management-group delete'] = """
+ type: command
+ short-summary: Delete an existing management group.
+ long-summary: Delete an existing management group.
+ parameters:
+ - name: --name -n
+ type: string
+ short-summary: Name of the management group.
+ examples:
+ - name: Delete an existing management group
+ text: >
+ az account management-group delete --name GroupName
+"""
+
+helps['account management-group subscription add'] = """
+ type: command
+ short-summary: Add a subscription to a management group.
+ long-summary: Add a subscription to a management group.
+ parameters:
+ - name: --name -n
+ type: string
+ short-summary: Name of the management group.
+ - name: --subscription -s
+ type: string
+ short-summary: Subscription Id or Name
+ examples:
+ - name: Add a subscription to a management group.
+ text: >
+ az account management-group subscription add --name GroupName
--subscription Subscription
+"""
+
+helps['account management-group subscription remove'] = """
+ type: command
+ short-summary: Remove an existing subscription from a management group.
+ long-summary: Remove an existing subscription from a management group.
+ parameters:
+ - name: --name -n
+ type: string
+ short-summary: Name of the management group.
+ - name: --subscription -s
+ type: string
+ short-summary: Subscription Id or Name
+ examples:
+ - name: Remove an existing subscription from a management group.
+ text: >
+ az account management-group subscription remove --name GroupName
--subscription Subscription
+"""
+
helps['policy'] = """
type: group
short-summary: Manage resource policies.
@@ -224,7 +374,7 @@
examples:
- name: Create a policy set definition.
text: |
- az policy setdefinition create -n readOnlyStorage
--definitions '[
+ az policy set-definition create -n readOnlyStorage
--definitions '[
{
"policyDefinitionId":
"/subscriptions/mySubId/providers/Microsoft.Authorization/policyDefinitions/storagePolicy"
}
@@ -309,7 +459,7 @@
examples:
- name: Show a virtual machine resource named 'MyVm'.
text: >
- az vm show -g MyResourceGroup -n MyVm --resource-type
"Microsoft.Compute/virtualMachines"
+ az resource show -g MyResourceGroup -n MyVm --resource-type
"Microsoft.Compute/virtualMachines"
- name: Show a web app using a resource identifier.
text: >
az resource show --ids
/subscriptions/0b1f6471-1bf0-4dda-aec3-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/MyWebapp
@@ -330,7 +480,7 @@
examples:
- name: Delete a virtual machine named 'MyVm'.
text: >
- az vm delete -g MyResourceGroup -n MyVm --resource-type
"Microsoft.Compute/virtualMachines"
+ az resource delete -g MyResourceGroup -n MyVm --resource-type
"Microsoft.Compute/virtualMachines"
- name: Delete a web app using a resource identifier.
text: >
az resource delete --ids
/subscriptions/0b1f6471-1bf0-4dda-aec3-111111111111/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/MyWebapp
@@ -517,6 +667,57 @@
type: group
short-summary: Manage deployment operations.
"""
+helps['deployment'] = """
+ type: group
+ short-summary: Manage Azure Resource Manager deployments at subscription
scope.
+"""
+helps['deployment create'] = """
+ type: command
+ short-summary: Start a deployment.
+ parameters:
+ - name: --parameters
+ short-summary: Supply deployment parameter values.
+ long-summary: >
+ Parameters may be supplied from a file using the `@{path}` syntax,
a JSON string, or as <KEY=VALUE> pairs. Parameters are evaluated in order, so
when a value is assigned twice, the latter value will be used.
+ It is recommended that you supply your parameters file first, and
then override selectively using KEY=VALUE syntax.
+ examples:
+ - name: Create a deployment from a remote template file, using
parameters from a local JSON file.
+ text: >
+ az deployment create --location WestUS --template-uri
https://myresource/azuredeploy.json --parameters @myparameters.json
+ - name: Create a deployment from a local template file, using
parameters from a JSON string.
+ text: |
+ az deployment create --location WestUS --template-file
azuredeploy.json --parameters '{
+ "policyName": {
+ "value": "policy2"
+ }
+ }'
+ - name: Create a deployment from a local template, using a parameter
file and selectively overriding key/value pairs.
+ text: >
+ az deployment create --location WestUS --template-file
azuredeploy.json \\
+ --parameters @params.json --parameters MyValue=This
[email protected]
+"""
+helps['deployment export'] = """
+ type: command
+ short-summary: Export the template used for a deployment.
+"""
+helps['deployment validate'] = """
+ type: command
+ short-summary: Validate whether a template is syntactically correct.
+ parameters:
+ - name: --parameters
+ short-summary: Supply deployment parameter values.
+ long-summary: >
+ Parameters may be supplied from a file using the `@{path}` syntax,
a JSON string, or as <KEY=VALUE> pairs. Parameters are evaluated in order, so
when a value is assigned twice, the latter value will be used.
+ It is recommended that you supply your parameters file first, and
then override selectively using KEY=VALUE syntax.
+"""
+helps['deployment wait'] = """
+ type: command
+ short-summary: Place the CLI in a waiting state until a deployment
condition is met.
+"""
+helps['deployment operation'] = """
+ type: group
+ short-summary: Manage deployment operations.
+"""
helps['group lock'] = """
type: group
short-summary: Manage Azure resource group locks.
@@ -609,7 +810,7 @@
helps['resource link create'] = """
type: command
short-summary: Create a new link between resources.
- long-summary: A link-id is of the form
/subscriptions/{SubID}/resourceGroups/{ResourceGroupID}/{ProviderNamespace}/{ResourceType}/{ResourceName}/Microsoft.Resources/links/{LinkName}
+ long-summary: A link-id is of the form
/subscriptions/{SubID}/resourceGroups/{ResourceGroupID}/providers/{ProviderNamespace}/{ResourceType}/{ResourceName}/providers/Microsoft.Resources/links/{LinkName}
examples:
- name: Create a link from {SourceID} to {ResourceID} with notes
text: >
@@ -618,7 +819,7 @@
helps['resource link update'] = """
type: command
short-summary: Update link between resources.
- long-summary: A link-id is of the form
/subscriptions/{SubID}/resourceGroups/{ResourceGroup}/{ProviderNamespace}/{ResourceType}/{ResourceName}/Microsoft.Resources/links/{LinkName}
+ long-summary: A link-id is of the form
/subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/{ProviderNamespace}/{ResourceType}/{ResourceName}/providers/Microsoft.Resources/links/{LinkName}
examples:
- name: Update the notes for {LinkID} notes "some notes to explain
this link"
text: >
@@ -627,7 +828,7 @@
helps['resource link delete'] = """
type: command
short-summary: Delete a link between resources.
- long-summary: A link-id is of the form
/subscriptions/{SubID}/resourceGroups/{ResourceGroupID}/{ProviderNamespace}/{ResourceType}/{ResourceName}/Microsoft.Resources/links/{LinkName}
+ long-summary: A link-id is of the form
/subscriptions/{SubID}/resourceGroups/{ResourceGroupID}/providers/{ProviderNamespace}/{ResourceType}/{ResourceName}/providers/Microsoft.Resources/links/{LinkName}
examples:
- name: Delete link {LinkID}
text: >
@@ -647,7 +848,7 @@
helps['resource link show'] = """
type: command
short-summary: Get details for a resource link.
- long-summary: A link-id is of the form
/subscriptions/{SubID}/resourceGroups/{ResourceGroup}/{ProviderNamespace}/{ResourceType}/{ResourceName}/Microsoft.Resources/links/{LinkName}
+ long-summary: A link-id is of the form
/subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/{ProviderNamespace}/{ResourceType}/{ResourceName}/providers/Microsoft.Resources/links/{LinkName}
"""
helps['resource lock'] = """
type: group
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_params.py
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_params.py
--- old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_params.py
2018-04-06 19:33:13.000000000 +0200
+++ new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_params.py
2018-08-23 01:07:57.000000000 +0200
@@ -12,8 +12,9 @@
from azure.mgmt.resource.locks.models import LockLevel
from azure.mgmt.resource.managedapplications.models import
ApplicationLockLevel
+ from azure.cli.core.api import get_subscription_id_list
from azure.cli.core.commands.parameters import (
- resource_group_name_type, tag_type, tags_type,
get_resource_group_completion_list, no_wait_type, file_type,
+ resource_group_name_type, get_location_type, tag_type, tags_type,
get_resource_group_completion_list, no_wait_type, file_type,
get_enum_type, get_three_state_flag)
from azure.cli.core.profiles import ResourceType
@@ -23,7 +24,7 @@
get_policy_completion_list, get_policy_set_completion_list,
get_policy_assignment_completion_list,
get_resource_types_completion_list, get_providers_completion_list)
from azure.cli.command_modules.resource._validators import (
- validate_lock_parameters, validate_resource_lock, validate_group_lock,
validate_subscription_lock, validate_metadata)
+ validate_lock_parameters, validate_resource_lock, validate_group_lock,
validate_subscription_lock, validate_metadata, RollbackAction)
# BASIC PARAMETER CONFIGURATION
@@ -136,6 +137,7 @@
c.argument('template_uri', help='a uri to a remote template file')
c.argument('mode', arg_type=get_enum_type(DeploymentMode,
default='incremental'), help='Incremental (only add resources to resource
group) or Complete (remove extra resources from resource group)')
c.argument('parameters', action='append', nargs='+',
completer=FilesCompleter())
+ c.argument('rollback_on_error', nargs='?', action=RollbackAction,
help='The name of a deployment to roll back to on error, or use as a flag to
roll back to the last successful deployment.')
with self.argument_context('group deployment create') as c:
c.argument('deployment_name', options_list=('--name', '-n'),
required=False,
@@ -144,6 +146,20 @@
with self.argument_context('group deployment operation show') as c:
c.argument('operation_ids', nargs='+', help='A list of operation ids
to show')
+ with self.argument_context('deployment') as c:
+ c.argument('deployment_name', options_list=('--name', '-n'),
required=True, help='The deployment name.')
+ c.argument('deployment_location',
arg_type=get_location_type(self.cli_ctx), required=True)
+ c.argument('template_file', completer=FilesCompleter(),
type=file_type, help="a template file path in the file system")
+ c.argument('template_uri', help='a uri to a remote template file')
+ c.argument('parameters', action='append', nargs='+',
completer=FilesCompleter())
+
+ with self.argument_context('deployment create') as c:
+ c.argument('deployment_name', options_list=('--name', '-n'),
required=False,
+ help='The deployment name. Default to template file base
name')
+
+ with self.argument_context('deployment operation show') as c:
+ c.argument('operation_ids', nargs='+', help='A list of operation ids
to show')
+
with self.argument_context('group export') as c:
c.argument('include_comments', action='store_true')
c.argument('include_parameter_default_value', action='store_true')
@@ -209,3 +225,22 @@
c.argument('authorizations', options_list=('--authorizations', '-a'),
nargs='+', help="space-separated authorization pairs in a format of
<principalId>:<roleDefinitionId>")
c.argument('createUiDefinition',
options_list=('--create-ui-definition', '-c'), help='JSON formatted string or a
path to a file with such content', type=file_type)
c.argument('mainTemplate', options_list=('--main-template', '-t'),
help='JSON formatted string or a path to a file with such content',
type=file_type)
+
+ with self.argument_context('account') as c:
+ c.argument('subscription', options_list=['--subscription', '-s'],
help='Name or ID of subscription.', completer=get_subscription_id_list)
+
+ with self.argument_context('account management-group') as c:
+ c.argument('group_name', options_list=['--name', '-n'])
+ c.ignore('_subscription') # hide global subscription parameter
+
+ with self.argument_context('account management-group show') as c:
+ c.argument('expand', options_list=['--expand', '-e'],
action='store_true')
+ c.argument('recurse', options_list=['--recurse', '-r'],
action='store_true')
+
+ with self.argument_context('account management-group create') as c:
+ c.argument('display_name', options_list=['--display-name', '-d'])
+ c.argument('parent', options_list=['--parent', '-p'])
+
+ with self.argument_context('account management-group update') as c:
+ c.argument('display_name', options_list=['--display-name', '-d'])
+ c.argument('parent_id', options_list=['--parent', '-p'])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_validators.py
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_validators.py
---
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/_validators.py
2018-04-06 19:33:13.000000000 +0200
+++
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/_validators.py
2018-08-23 01:07:57.000000000 +0200
@@ -5,6 +5,7 @@
import os
import re
+import argparse
from knack.util import CLIError
try:
@@ -147,3 +148,9 @@
def validate_metadata(namespace):
if namespace.metadata:
namespace.metadata = dict(x.split('=', 1) for x in namespace.metadata)
+
+
+# pylint: disable=too-few-public-methods
+class RollbackAction(argparse.Action):
+ def __call__(self, parser, namespace, values, option_string=None):
+ setattr(namespace, 'rollback_on_error', '' if not values else values)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/commands.py
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/commands.py
---
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/commands.py
2018-04-06 19:33:13.000000000 +0200
+++ new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/commands.py
2018-08-23 01:07:57.000000000 +0200
@@ -10,13 +10,16 @@
from azure.cli.core.util import empty_on_404
from azure.cli.core.profiles import ResourceType
from azure.cli.core.commands import CliCommandType
+from azure.cli.core.commands.arm import handle_template_based_exception
from azure.cli.command_modules.resource._client_factory import (
cf_resource_groups, cf_providers, cf_features, cf_tags, cf_deployments,
cf_deployment_operations, cf_policy_definitions,
cf_policy_set_definitions, cf_resource_links,
- cf_resource_managedapplications, cf_resource_managedappdefinitions)
+ cf_resource_managedapplications, cf_resource_managedappdefinitions,
cf_management_groups, cf_management_group_subscriptions)
from azure.cli.command_modules.resource._validators import
process_deployment_create_namespace
+from ._exception_handler import managementgroups_exception_handler
+
# Resource group commands
def transform_resource_group_list(result):
@@ -118,34 +121,52 @@
resource_type=ResourceType.MGMT_RESOURCE_RESOURCES
)
+ resource_managementgroups_sdk = CliCommandType(
+
operations_tmpl='azure.mgmt.managementgroups.operations.management_groups_operations#ManagementGroupsOperations.{}',
+ client_factory=cf_management_groups,
+ exception_handler=managementgroups_exception_handler
+ )
+
+ resource_managementgroups_subscriptions_sdk = CliCommandType(
+
operations_tmpl='azure.mgmt.managementgroups.operations.management_group_subscriptions_operations#ManagementGroupSubscriptionsOperations.{}',
+ client_factory=cf_management_group_subscriptions,
+ exception_handler=managementgroups_exception_handler
+ )
+
+ resource_managementgroups_update_type = CliCommandType(
+ operations_tmpl='azure.cli.command_modules.resource.custom#{}',
+ client_factory=cf_management_groups,
+ exception_handler=managementgroups_exception_handler
+ )
+
with self.command_group('account lock', resource_lock_sdk,
resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
g.custom_command('create', 'create_lock')
g.custom_command('delete', 'delete_lock')
g.custom_command('list', 'list_locks')
- g.custom_command('show', 'get_lock', exception_handler=empty_on_404)
+ g.custom_show_command('show', 'get_lock')
g.custom_command('update', 'update_lock')
with self.command_group('group', resource_group_sdk,
resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
g.command('delete', 'delete', supports_no_wait=True, confirmation=True)
- g.command('show', 'get', exception_handler=empty_on_404)
+ g.show_command('show', 'get')
g.command('exists', 'check_existence')
g.custom_command('list', 'list_resource_groups',
table_transformer=transform_resource_group_list)
g.custom_command('create', 'create_resource_group')
g.custom_command('export', 'export_group_as_template')
- g.generic_update_command('update')
- g.generic_wait_command('wait')
+ g.generic_update_command('update',
custom_func_name='update_resource_group', custom_func_type=resource_custom)
+ g.wait_command('wait')
with self.command_group('group lock',
resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
g.custom_command('create', 'create_lock')
g.custom_command('delete', 'delete_lock')
g.custom_command('list', 'list_locks')
- g.custom_command('show', 'get_lock', exception_handler=empty_on_404)
+ g.custom_show_command('show', 'get_lock')
g.custom_command('update', 'update_lock')
with self.command_group('resource', resource_custom,
resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
g.custom_command('create', 'create_resource')
g.custom_command('delete', 'delete_resource')
- g.custom_command('show', 'show_resource',
exception_handler=empty_on_404)
+ g.custom_show_command('show', 'show_resource')
g.custom_command('list', 'list_resources',
table_transformer=transform_resource_list)
g.custom_command('tag', 'tag_resource')
g.custom_command('move', 'move_resource')
@@ -157,23 +178,23 @@
g.custom_command('create', 'create_lock')
g.custom_command('delete', 'delete_lock')
g.custom_command('list', 'list_locks')
- g.custom_command('show', 'get_lock', exception_handler=empty_on_404)
+ g.custom_show_command('show', 'get_lock')
g.custom_command('update', 'update_lock')
# Resource provider commands
with self.command_group('provider', resource_provider_sdk,
resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
g.command('list', 'list')
- g.command('show', 'get', exception_handler=empty_on_404)
+ g.show_command('show', 'get')
g.custom_command('register', 'register_provider')
g.custom_command('unregister', 'unregister_provider')
g.custom_command('operation list', 'list_provider_operations')
- g.custom_command('operation show', 'show_provider_operations')
+ g.custom_show_command('operation show', 'show_provider_operations')
# Resource feature commands
with self.command_group('feature', resource_feature_sdk,
client_factory=cf_features, resource_type=ResourceType.MGMT_RESOURCE_FEATURES)
as g:
feature_table_transform = '{Name:name,
RegistrationState:properties.state}'
g.custom_command('list', 'list_features', table_transformer='[].' +
feature_table_transform)
- g.command('show', 'get', exception_handler=empty_on_404,
table_transformer=feature_table_transform)
+ g.show_command('show', 'get',
table_transformer=feature_table_transform)
g.custom_command('register', 'register_feature')
# Tag commands
@@ -185,61 +206,93 @@
g.command('remove-value', 'delete_value')
with self.command_group('group deployment', resource_deployment_sdk) as g:
- g.custom_command('create', 'deploy_arm_template',
supports_no_wait=True, validator=process_deployment_create_namespace)
+ g.custom_command('create', 'deploy_arm_template',
supports_no_wait=True, validator=process_deployment_create_namespace,
exception_handler=handle_template_based_exception)
g.command('list', 'list_by_resource_group',
table_transformer=transform_deployments_list, min_api='2017-05-10')
g.command('list', 'list',
table_transformer=transform_deployments_list, max_api='2016-09-01')
- g.command('show', 'get', exception_handler=empty_on_404)
- g.command('delete', 'delete')
- g.custom_command('validate', 'validate_arm_template',
table_transformer=deployment_validate_table_format)
+ g.show_command('show', 'get')
+ g.command('delete', 'delete', supports_no_wait=True)
+ g.custom_command('validate', 'validate_arm_template',
table_transformer=deployment_validate_table_format,
exception_handler=handle_template_based_exception)
g.custom_command('export', 'export_deployment_as_template')
- g.generic_wait_command('wait')
+ g.wait_command('wait')
with self.command_group('group deployment operation',
resource_deployment_operation_sdk) as g:
g.command('list', 'list')
- g.custom_command('show', 'get_deployment_operations',
client_factory=cf_deployment_operations, exception_handler=empty_on_404)
+ g.custom_show_command('show', 'get_deployment_operations',
client_factory=cf_deployment_operations)
+
+ with self.command_group('deployment', resource_deployment_sdk,
min_api='2018-05-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
+ g.command('list', 'list_at_subscription_scope',
table_transformer=transform_deployments_list)
+ g.show_command('show', 'get_at_subscription_scope')
+ g.command('delete', 'delete_at_subscription_scope',
supports_no_wait=True)
+ g.custom_command('validate',
'validate_arm_template_at_subscription_scope',
table_transformer=deployment_validate_table_format,
exception_handler=handle_template_based_exception)
+ g.custom_command('create',
'deploy_arm_template_at_subscription_scope', supports_no_wait=True,
validator=process_deployment_create_namespace,
exception_handler=handle_template_based_exception)
+ g.custom_command('export', 'export_subscription_deployment_template')
+ g.wait_command('wait', getter_name='get_at_subscription_scope')
+
+ with self.command_group('deployment operation',
resource_deployment_operation_sdk, min_api='2018-05-01',
resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
+ g.command('list', 'list_at_subscription_scope')
+ g.custom_show_command('show',
'get_deployment_operations_at_subscription_scope',
client_factory=cf_deployment_operations)
with self.command_group('policy assignment',
resource_type=ResourceType.MGMT_RESOURCE_POLICY) as g:
g.custom_command('create', 'create_policy_assignment')
g.custom_command('delete', 'delete_policy_assignment')
g.custom_command('list', 'list_policy_assignment')
- g.custom_command('show', 'show_policy_assignment',
exception_handler=empty_on_404)
+ g.custom_show_command('show', 'show_policy_assignment')
with self.command_group('policy definition',
resource_policy_definitions_sdk,
resource_type=ResourceType.MGMT_RESOURCE_POLICY) as g:
g.custom_command('create', 'create_policy_definition')
g.command('delete', 'delete')
g.command('list', 'list')
- g.custom_command('show', 'get_policy_definition',
exception_handler=empty_on_404)
+ g.custom_show_command('show', 'get_policy_definition')
g.generic_update_command('update',
custom_func_name='update_policy_definition', custom_func_type=resource_custom)
with self.command_group('policy set-definition',
resource_policy_set_definitions_sdk,
resource_type=ResourceType.MGMT_RESOURCE_POLICY, min_api='2017-06-01-preview')
as g:
g.custom_command('create', 'create_policy_setdefinition')
g.command('delete', 'delete')
g.command('list', 'list')
- g.custom_command('show', 'get_policy_setdefinition',
exception_handler=empty_on_404)
+ g.custom_show_command('show', 'get_policy_setdefinition')
g.custom_command('update', 'update_policy_setdefinition')
with self.command_group('lock',
resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
g.custom_command('create', 'create_lock')
g.custom_command('delete', 'delete_lock')
g.custom_command('list', 'list_locks')
- g.custom_command('show', 'get_lock', exception_handler=empty_on_404)
+ g.custom_show_command('show', 'get_lock')
g.custom_command('update', 'update_lock')
with self.command_group('resource link', resource_link_sdk,
resource_type=ResourceType.MGMT_RESOURCE_LINKS) as g:
g.custom_command('create', 'create_resource_link')
g.command('delete', 'delete')
- g.command('show', 'get', exception_handler=empty_on_404)
+ g.show_command('show', 'get')
g.custom_command('list', 'list_resource_links')
g.custom_command('update', 'update_resource_link')
with self.command_group('managedapp', resource_managedapp_sdk,
min_api='2017-05-10', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
g.custom_command('create', 'create_application')
g.command('delete', 'delete')
- g.custom_command('show', 'show_application',
exception_handler=empty_on_404)
+ g.custom_show_command('show', 'show_application')
g.custom_command('list', 'list_applications')
with self.command_group('managedapp definition',
resource_managedapp_def_sdk, min_api='2017-05-10',
resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
g.custom_command('create', 'create_applicationdefinition')
g.command('delete', 'delete')
- g.custom_command('show', 'show_applicationdefinition')
+ g.custom_show_command('show', 'show_applicationdefinition')
g.command('list', 'list_by_resource_group',
exception_handler=empty_on_404)
+
+ with self.command_group('account management-group',
resource_managementgroups_sdk, client_factory=cf_management_groups) as g:
+ g.custom_command('list', 'cli_managementgroups_group_list')
+ g.custom_show_command('show', 'cli_managementgroups_group_show')
+ g.custom_command('create', 'cli_managementgroups_group_create')
+ g.custom_command('delete', 'cli_managementgroups_group_delete')
+ g.generic_update_command(
+ 'update',
+ getter_name='cli_managementgroups_group_update_get',
+ getter_type=resource_managementgroups_update_type,
+ setter_name='cli_managementgroups_group_update_set',
+ setter_type=resource_managementgroups_update_type,
+ custom_func_name='cli_managementgroups_group_update_custom_func',
+ custom_func_type=resource_managementgroups_update_type,
+ exception_handler=managementgroups_exception_handler)
+
+ with self.command_group('account management-group subscription',
resource_managementgroups_subscriptions_sdk,
client_factory=cf_management_group_subscriptions) as g:
+ g.custom_command('add', 'cli_managementgroups_subscription_add')
+ g.custom_command('remove', 'cli_managementgroups_subscription_remove')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/custom.py
new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/custom.py
--- old/azure-cli-resource-2.0.27/azure/cli/command_modules/resource/custom.py
2018-04-06 19:33:13.000000000 +0200
+++ new/azure-cli-resource-2.1.3/azure/cli/command_modules/resource/custom.py
2018-08-23 01:07:57.000000000 +0200
@@ -4,6 +4,7 @@
#
--------------------------------------------------------------------------------------------
# pylint: disable=too-many-lines
+# pylint: disable=line-too-long
from __future__ import print_function
from collections import OrderedDict
@@ -32,7 +33,7 @@
from azure.cli.core.parser import IncorrectUsageError
from azure.cli.core.util import get_file_json, shell_safe_json_parse,
sdk_no_wait
from azure.cli.core.commands.client_factory import get_mgmt_service_client
-from azure.cli.core.profiles import ResourceType, get_sdk
+from azure.cli.core.profiles import ResourceType, get_sdk, get_api_version
from azure.cli.command_modules.resource._client_factory import (
_resource_client_factory, _resource_policy_client_factory,
_resource_lock_client_factory,
@@ -58,6 +59,10 @@
return None
def _try_parse_key_value_object(template_param_defs, parameters, value):
+ # support situation where empty JSON "{}" is provided
+ if value == '{}' and not parameters:
+ return True
+
try:
key, value = value.split('=', 1)
except ValueError:
@@ -89,7 +94,7 @@
for params in parameter_lists or []:
for item in params:
param_obj = _try_load_file_object(item) or
_try_parse_json_object(item)
- if param_obj:
+ if param_obj is not None:
parameters.update(param_obj)
elif not _try_parse_key_value_object(template_param_defs,
parameters, item):
raise CLIError('Unable to parse parameter: {}'.format(item))
@@ -218,8 +223,50 @@
def _deploy_arm_template_core(cli_ctx, resource_group_name, # pylint:
disable=too-many-arguments
template_file=None, template_uri=None,
deployment_name=None,
- parameters=None, mode=None, validate_only=False,
+ parameters=None, mode=None,
rollback_on_error=None, validate_only=False,
no_wait=False):
+ DeploymentProperties, TemplateLink, OnErrorDeployment = get_sdk(cli_ctx,
ResourceType.MGMT_RESOURCE_RESOURCES,
+
'DeploymentProperties', 'TemplateLink',
+
'OnErrorDeployment', mod='models')
+ template = None
+ template_link = None
+ template_obj = None
+ on_error_deployment = None
+
+ if template_uri:
+ template_link = TemplateLink(uri=template_uri)
+ template_obj =
shell_safe_json_parse(_urlretrieve(template_uri).decode('utf-8'),
preserve_order=True)
+ else:
+ template = get_file_json(template_file, preserve_order=True)
+ template_obj = template
+
+ if rollback_on_error == '':
+ on_error_deployment = OnErrorDeployment(type='LastSuccessful')
+ elif rollback_on_error:
+ on_error_deployment = OnErrorDeployment(type='SpecificDeployment',
deployment_name=rollback_on_error)
+
+ template_param_defs = template_obj.get('parameters', {})
+ template_obj['resources'] = template_obj.get('resources', [])
+ parameters = _process_parameters(template_param_defs, parameters) or {}
+ parameters = _get_missing_parameters(parameters, template_obj,
_prompt_for_parameters)
+
+ template = json.loads(json.dumps(template))
+ parameters = json.loads(json.dumps(parameters))
+
+ properties = DeploymentProperties(template=template,
template_link=template_link,
+ parameters=parameters, mode=mode,
on_error_deployment=on_error_deployment)
+
+ smc = get_mgmt_service_client(cli_ctx,
ResourceType.MGMT_RESOURCE_RESOURCES)
+ if validate_only:
+ return sdk_no_wait(no_wait, smc.deployments.validate,
resource_group_name, deployment_name, properties)
+ return sdk_no_wait(no_wait, smc.deployments.create_or_update,
resource_group_name, deployment_name, properties)
+
+
+def _deploy_arm_template_subscription_scope(cli_ctx, # pylint:
disable=too-many-arguments
+ template_file=None,
template_uri=None,
+ deployment_name=None,
deployment_location=None,
+ parameters=None, mode=None,
validate_only=False,
+ no_wait=False):
DeploymentProperties, TemplateLink = get_sdk(cli_ctx,
ResourceType.MGMT_RESOURCE_RESOURCES,
'DeploymentProperties',
'TemplateLink', mod='models')
template = None
@@ -245,8 +292,10 @@
smc = get_mgmt_service_client(cli_ctx,
ResourceType.MGMT_RESOURCE_RESOURCES)
if validate_only:
- return sdk_no_wait(no_wait, smc.deployments.validate,
resource_group_name, deployment_name, properties)
- return sdk_no_wait(no_wait, smc.deployments.create_or_update,
resource_group_name, deployment_name, properties)
+ return sdk_no_wait(no_wait,
smc.deployments.validate_at_subscription_scope,
+ deployment_name, properties, deployment_location)
+ return sdk_no_wait(no_wait,
smc.deployments.create_or_update_at_subscription_scope,
+ deployment_name, properties, deployment_location)
def _list_resources_odata_filter_builder(resource_group_name=None,
resource_provider_namespace=None,
@@ -452,6 +501,14 @@
return rcf.resource_groups.create_or_update(rg_name, parameters)
+def update_resource_group(instance, tags=None):
+
+ if tags is not None:
+ instance.tags = tags
+
+ return instance
+
+
def export_group_as_template(
cmd, resource_group_name, include_comments=False,
include_parameter_default_value=False):
"""Captures a resource group as a template.
@@ -592,10 +649,14 @@
for name_value in authorizations:
# split at the first ':', neither principalId nor roldeDefinitionId
should have a ':'
principalId, roleDefinitionId = name_value.split(':', 1)
- applicationAuth = ApplicationProviderAuthorization(principalId,
roleDefinitionId)
+ applicationAuth = ApplicationProviderAuthorization(
+ principal_id=principalId,
+ role_definition_id=roleDefinitionId)
applicationAuthList.append(applicationAuth)
- applicationDef = ApplicationDefinition(lock_level, applicationAuthList,
package_file_uri)
+ applicationDef = ApplicationDefinition(lock_level=lock_level,
+ authorizations=applicationAuthList,
+ package_file_uri=package_file_uri)
applicationDef.display_name = display_name
applicationDef.description = description
applicationDef.location = location
@@ -620,15 +681,38 @@
def deploy_arm_template(cmd, resource_group_name,
template_file=None, template_uri=None,
deployment_name=None,
- parameters=None, mode=None, no_wait=False):
+ parameters=None, mode=None, rollback_on_error=None,
no_wait=False):
return _deploy_arm_template_core(cmd.cli_ctx, resource_group_name,
template_file, template_uri,
- deployment_name, parameters, mode,
no_wait=no_wait)
+ deployment_name, parameters, mode,
rollback_on_error, no_wait=no_wait)
+
+
+def deploy_arm_template_at_subscription_scope(cmd, template_file=None,
template_uri=None,
+ deployment_name=None,
deployment_location=None,
+ parameters=None, no_wait=False):
+ return _deploy_arm_template_subscription_scope(cmd.cli_ctx, template_file,
template_uri,
+ deployment_name,
deployment_location,
+ parameters, 'Incremental',
no_wait=no_wait)
def validate_arm_template(cmd, resource_group_name, template_file=None,
template_uri=None,
- parameters=None, mode=None):
+ parameters=None, mode=None, rollback_on_error=None):
return _deploy_arm_template_core(cmd.cli_ctx, resource_group_name,
template_file, template_uri,
- 'deployment_dry_run', parameters, mode,
validate_only=True)
+ 'deployment_dry_run', parameters, mode,
rollback_on_error, validate_only=True)
+
+
+def validate_arm_template_at_subscription_scope(cmd, template_file=None,
template_uri=None, deployment_location=None,
+ parameters=None):
+ return _deploy_arm_template_subscription_scope(cmd.cli_ctx, template_file,
template_uri,
+ 'deployment_dry_run',
deployment_location,
+ parameters,
+ 'Incremental',
+ validate_only=True)
+
+
+def export_subscription_deployment_template(cmd, deployment_name):
+ smc = _resource_client_factory(cmd.cli_ctx)
+ result =
smc.deployments.export_template_at_subscription_scope(deployment_name)
+ print(json.dumps(result.template, indent=2)) # pylint: disable=no-member
def export_deployment_as_template(cmd, resource_group_name, deployment_name):
@@ -815,6 +899,15 @@
return result
+def get_deployment_operations_at_subscription_scope(client, deployment_name,
operation_ids):
+ """get a deployment's operation."""
+ result = []
+ for op_id in operation_ids:
+ dep = client.get_at_subscription_scope(deployment_name, op_id)
+ result.append(dep)
+ return result
+
+
def list_resources(cmd, resource_group_name=None,
resource_provider_namespace=None, resource_type=None,
name=None, tag=None,
location=None):
@@ -844,7 +937,10 @@
def show_provider_operations(cmd, resource_provider_namespace):
+ version = getattr(get_api_version(cmd.cli_ctx,
ResourceType.MGMT_AUTHORIZATION), 'provider_operations_metadata')
auth_client = _authorization_management_client(cmd.cli_ctx)
+ if version == '2015-07-01':
+ return
auth_client.provider_operations_metadata.get(resource_provider_namespace,
version)
return
auth_client.provider_operations_metadata.get(resource_provider_namespace)
@@ -910,7 +1006,7 @@
params = shell_safe_json_parse(params)
PolicyAssignment = cmd.get_models('PolicyAssignment')
- assignment = PolicyAssignment(display_name, policy_id, scope)
+ assignment = PolicyAssignment(display_name=display_name,
policy_definition_id=policy_id, scope=scope)
assignment.parameters = params if params else None
if cmd.supported_api_version(min_api='2017-06-01-preview'):
@@ -925,9 +1021,9 @@
return
assignment.not_scopes = kwargs_list
PolicySku = cmd.get_models('PolicySku')
- policySku = PolicySku('A0', 'Free')
+ policySku = PolicySku(name='A0', tier='Free')
if sku:
- policySku = policySku if sku.lower() == 'free' else
PolicySku('A1', 'Standard')
+ policySku = policySku if sku.lower() == 'free' else
PolicySku(name='A1', tier='Standard')
assignment.sku = policySku
return policy_client.policy_assignments.create(scope,
@@ -1077,8 +1173,120 @@
return
policy_client.policy_set_definitions.create_or_update(policy_set_definition_name,
parameters)
+def _register_rp(cli_ctx, subscription_id=None):
+ rp = "Microsoft.Management"
+ import time
+ rcf = get_mgmt_service_client(
+ cli_ctx,
+ ResourceType.MGMT_RESOURCE_RESOURCES,
+ subscription_id)
+ rcf.providers.register(rp)
+ while True:
+ time.sleep(10)
+ rp_info = rcf.providers.get(rp)
+ if rp_info.registration_state == 'Registered':
+ break
+
+
+def _get_subscription_id_from_subscription(cli_ctx, subscription): # pylint:
disable=inconsistent-return-statements
+ from azure.cli.core._profile import Profile
+ profile = Profile(cli_ctx=cli_ctx)
+ subscriptions_list = profile.load_cached_subscriptions()
+ for sub in subscriptions_list:
+ if sub['id'] == subscription or sub['name'] == subscription:
+ return sub['id']
+ raise CLIError("Subscription not found in the current context.")
+
+
+def _get_parent_id_from_parent(parent):
+ if parent is None or
parent.startswith("/providers/Microsoft.Management/managementGroups/"):
+ return parent
+ return "/providers/Microsoft.Management/managementGroups/" + parent
+
+
+def cli_managementgroups_group_list(cmd, client):
+ _register_rp(cmd.cli_ctx)
+ return client.list()
+
+
+def cli_managementgroups_group_show(
+ cmd,
+ client,
+ group_name,
+ expand=False,
+ recurse=False):
+ _register_rp(cmd.cli_ctx)
+ if expand:
+ return client.get(group_name, "children", recurse)
+ return client.get(group_name)
+
+
+def cli_managementgroups_group_create(
+ cmd,
+ client,
+ group_name,
+ display_name=None,
+ parent=None):
+ _register_rp(cmd.cli_ctx)
+ parent_id = _get_parent_id_from_parent(parent)
+ from azure.mgmt.managementgroups.models import (
+ CreateManagementGroupRequest, CreateManagementGroupDetails,
CreateParentGroupInfo)
+ create_parent_grp_info = CreateParentGroupInfo(id=parent_id)
+ create_mgmt_grp_details =
CreateManagementGroupDetails(parent=create_parent_grp_info)
+ create_mgmt_grp_request = CreateManagementGroupRequest(
+ name=group_name,
+ display_name=display_name,
+ details=create_mgmt_grp_details)
+ return client.create_or_update(group_name, create_mgmt_grp_request)
+
+
+def cli_managementgroups_group_update_custom_func(
+ instance,
+ display_name=None,
+ parent_id=None):
+ parent_id = _get_parent_id_from_parent(parent_id)
+ instance.display_name = display_name
+ instance.parent_id = parent_id
+ return instance
+
+
+def cli_managementgroups_group_update_get():
+ from azure.mgmt.managementgroups.models import PatchManagementGroupRequest
+ update_parameters = PatchManagementGroupRequest(display_name=None,
parent_id=None)
+ return update_parameters
+
+
+def cli_managementgroups_group_update_set(
+ cmd, client, group_name, parameters=None):
+ return client.update(group_name, parameters)
+
+
+def cli_managementgroups_group_delete(cmd, client, group_name):
+ _register_rp(cmd.cli_ctx)
+ return client.delete(group_name)
+
+
+def cli_managementgroups_subscription_add(
+ cmd, client, group_name, subscription):
+ subscription_id = _get_subscription_id_from_subscription(
+ cmd.cli_ctx, subscription)
+ _register_rp(cmd.cli_ctx)
+ _register_rp(cmd.cli_ctx, subscription_id)
+ return client.create(group_name, subscription_id)
+
+
+def cli_managementgroups_subscription_remove(
+ cmd, client, group_name, subscription):
+ subscription_id = _get_subscription_id_from_subscription(
+ cmd.cli_ctx, subscription)
+ _register_rp(cmd.cli_ctx)
+ _register_rp(cmd.cli_ctx, subscription_id)
+ return client.delete(group_name, subscription_id)
+
+
# region Locks
+
def _validate_lock_params_match_lock(
lock_client, name, resource_group, resource_provider_namespace,
parent_resource_path,
resource_type, resource_name):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure_cli_resource.egg-info/PKG-INFO
new/azure-cli-resource-2.1.3/azure_cli_resource.egg-info/PKG-INFO
--- old/azure-cli-resource-2.0.27/azure_cli_resource.egg-info/PKG-INFO
2018-04-06 19:33:47.000000000 +0200
+++ new/azure-cli-resource-2.1.3/azure_cli_resource.egg-info/PKG-INFO
2018-08-23 01:09:32.000000000 +0200
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: azure-cli-resource
-Version: 2.0.27
+Version: 2.1.3
Summary: Microsoft Azure Command-Line Tools Resource Command Module
Home-page: https://github.com/Azure/azure-cli
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT
-Description-Content-Type: UNKNOWN
Description: Microsoft Azure CLI 'resource' Command Module
=============================================
@@ -20,6 +19,47 @@
Release History
===============
+ 2.1.3
+ +++++
+ * `provider operation show`: exception handling to exit with code 3
upon a missing resource for consistency.
+
+ 2.1.2
+ +++++
+ * Minor changes
+
+ 2.1.1
+ +++++
+ * `group deployment create`: Add `--rollback-on-error` to execute a
known-good deployment on error.
+ * `group deployment create`: Fix issue where `--parameters {}`
resulted in an error.
+
+ 2.1.0
+ +++++
+ * BREAKING CHANGE: 'show' commands log error message and fail with
exit code of 3 upon a missing resource.
+ * `group deployment delete`: Add `--no-wait` support.
+ * `deployment delete`: Add `--no-wait` support.
+ * Added `deployment wait` command.
+ * Fix issue where the subscription-level `az deployment` commands
erroneously appeared for profile 2017-03-09-profile.
+
+ 2.0.32
+ ++++++
+ * Support deployment at subscription scope: new operation group
`deployment`.
+
+ 2.0.31
+ ++++++
+ * Minor changes
+
+ 2.0.30
+ ++++++
+ * add `account management-group` commands.
+
+ 2.0.29
+ ++++++
+ * Minor changes
+
+ 2.0.28
+ ++++++
+ * Minor changes
+
2.0.27
++++++
* `policy definition create`: Add support for `--metadata`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure_cli_resource.egg-info/SOURCES.txt
new/azure-cli-resource-2.1.3/azure_cli_resource.egg-info/SOURCES.txt
--- old/azure-cli-resource-2.0.27/azure_cli_resource.egg-info/SOURCES.txt
2018-04-06 19:33:47.000000000 +0200
+++ new/azure-cli-resource-2.1.3/azure_cli_resource.egg-info/SOURCES.txt
2018-08-23 01:09:32.000000000 +0200
@@ -9,6 +9,7 @@
azure/cli/command_modules/resource/__init__.py
azure/cli/command_modules/resource/_client_factory.py
azure/cli/command_modules/resource/_completers.py
+azure/cli/command_modules/resource/_exception_handler.py
azure/cli/command_modules/resource/_help.py
azure/cli/command_modules/resource/_params.py
azure/cli/command_modules/resource/_validators.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/azure-cli-resource-2.0.27/azure_cli_resource.egg-info/requires.txt
new/azure-cli-resource-2.1.3/azure_cli_resource.egg-info/requires.txt
--- old/azure-cli-resource-2.0.27/azure_cli_resource.egg-info/requires.txt
2018-04-06 19:33:47.000000000 +0200
+++ new/azure-cli-resource-2.1.3/azure_cli_resource.egg-info/requires.txt
2018-08-23 01:09:32.000000000 +0200
@@ -1,3 +1,3 @@
-azure-mgmt-resource==1.2.1
azure-cli-core
-azure-mgmt-authorization==0.40.0
+azure-mgmt-authorization==0.50.0
+azure-mgmt-managementgroups==0.1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/azure-cli-resource-2.0.27/setup.py
new/azure-cli-resource-2.1.3/setup.py
--- old/azure-cli-resource-2.0.27/setup.py 2018-04-06 19:33:13.000000000
+0200
+++ new/azure-cli-resource-2.1.3/setup.py 2018-08-23 01:07:57.000000000
+0200
@@ -14,7 +14,7 @@
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}
-VERSION = "2.0.27"
+VERSION = "2.1.3"
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
@@ -31,9 +31,9 @@
]
DEPENDENCIES = [
- 'azure-mgmt-resource==1.2.1',
'azure-cli-core',
- 'azure-mgmt-authorization==0.40.0'
+ 'azure-mgmt-authorization==0.50.0',
+ 'azure-mgmt-managementgroups==0.1.0'
]
with open('README.rst', 'r', encoding='utf-8') as f: