Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
00b9235
{Docs} Remove stale reference in README to closed issue about extensi…
dkmiller Apr 27, 2020
ab16df0
Merge remote-tracking branch 'upstream/release'
azclibot Apr 28, 2020
03436bc
Merge remote-tracking branch 'upstream/release'
azclibot Apr 30, 2020
7d98b1f
Merge remote-tracking branch 'upstream/release'
azclibot May 19, 2020
06f6ec5
Merge remote-tracking branch 'upstream/release'
azclibot Jun 2, 2020
125406f
Merge branch 'master' of git://github.com/Azure/azure-cli into dev
Jun 16, 2020
a497390
Preliminary changes made to add support for template-specs
Jun 22, 2020
e43a151
Reconfiguration
Jun 22, 2020
adab2d2
Merge remote-tracking branch 'upstream/release'
azclibot Jun 23, 2020
37c8522
Merge branch 'master' of git://github.com/Azure/azure-cli into dev
Jun 23, 2020
ef1e3f2
Merge remote-tracking branch 'upstream/dev' into dev
Jun 26, 2020
50e7c9c
validate function error rectified
Jun 27, 2020
68f47fd
validate command works for template-uri
Jun 29, 2020
7f184f8
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jun 29, 2020
bf962b1
Template-specs deployment works at resource-group level
Jun 29, 2020
4b90edd
Group deployment updated to function with 2020 SDK
Jun 30, 2020
4f39504
validate with template specs added
Jun 30, 2020
2e04882
Management scope and tenant scope errors fixed
Jul 1, 2020
7be894f
Testing Complete
Jul 2, 2020
87ccc2e
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jul 6, 2020
4f1348c
Template-Specs Deployment Added
Jul 6, 2020
9eb09f2
Template-Specs Deployment Added
Jul 6, 2020
44362eb
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jul 6, 2020
cf7b97a
Updated test cases and removed unnecessary comments
Jul 6, 2020
fb78986
Removed test cases from launch.json
Jul 6, 2020
504fda7
Uncommented test case
Jul 6, 2020
8f21f7c
Cleaned up repo
Jul 6, 2020
e73132c
Cleaned up repo
Jul 6, 2020
e8153f8
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jul 7, 2020
eac8414
Style checks complete, template_spec parameter placed at the end, tim…
Jul 8, 2020
74666fe
Merged with /dev
Jul 8, 2020
0e28ed8
Fixed failing CLI Check Test
Jul 8, 2020
583352f
Added fixes for deployment create_or_update and validate usage
Jul 9, 2020
a6344b8
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jul 9, 2020
2b43c88
Fix getting resource API version in ARM cmdlt
eladperets Aug 5, 2020
045b6e1
resetting branch
Aug 6, 2020
9b3fa34
reset
Aug 6, 2020
8153cec
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Sep 1, 2020
f4f8df7
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Oct 11, 2020
66cb18e
Added confirmation for az ts create
Oct 12, 2020
606c441
Launch.json restored
Oct 12, 2020
ed630fa
Testing files updated
Oct 12, 2020
ae9c459
Merge branch 'dev' of git://github.com/Azure/azure-cli into daetienn/…
Oct 12, 2020
0027459
Testing files updated
Oct 13, 2020
c8e5075
Merge branch 'dev' of git://github.com/Azure/azure-cli into daetienn/…
Oct 13, 2020
162c5bb
Merge branch 'dev' of git://github.com/Azure/azure-cli into daetienn/…
Oct 14, 2020
6587a47
Merge branch 'dev' of git://github.com/Azure/azure-cli into daetienn/…
Oct 19, 2020
09b7a66
Unique value in sub deployment, ts parameter name updated
Oct 19, 2020
27310f3
Unique value in sub deployment updated
Oct 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ def load_arguments(self, _):
c.argument('display_name', arg_type=ts_display_name_type)
c.argument('description', arg_type=ts_description_type)
c.argument('version_description', arg_type=ts_version_description_type)
c.argument('no_prompt', options_list=['--yes', '-y'], action='store_true', help='Do not prompt for confirmation')

with self.argument_context('ts update') as c:
c.argument('resource_group', arg_type=resource_group_name_type, help='The resource group to store the template spec.')
Expand Down
27 changes: 20 additions & 7 deletions src/azure-cli/azure/cli/command_modules/resource/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ def get_template_spec(cmd, resource_group_name=None, name=None, version=None, te


def create_template_spec(cmd, resource_group_name, name, template_file=None, location=None, display_name=None,
description=None, version=None, version_description=None):
description=None, version=None, version_description=None, no_prompt=False):
artifacts = None
input_template = None
if location is None:
Expand All @@ -1760,18 +1760,31 @@ def create_template_spec(cmd, resource_group_name, name, template_file=None, loc
rcf = _resource_templatespecs_client_factory(cmd.cli_ctx)

if version:
Exists = False
if no_prompt is False:
try: # Check if child template spec already exists.
existing_ts = rcf.template_spec_versions.get(resource_group_name=resource_group_name, template_spec_name=name, template_spec_version=version)
from knack.prompting import prompt_y_n
confirmation = prompt_y_n("This will override {}. Proceed?".format(existing_ts))
if not confirmation:
return None
Exists = True
except Exception: # pylint: disable=broad-except
pass

if template_file:
from azure.cli.command_modules.resource._packing_engine import (pack)
packed_template = pack(cmd, template_file)
input_template = getattr(packed_template, 'RootTemplate')
artifacts = getattr(packed_template, 'Artifacts')

try: # Check if parent template spec already exists.
rcf.template_specs.get(resource_group_name=resource_group_name, template_spec_name=name)
except Exception: # pylint: disable=broad-except
TemplateSpec = get_sdk(cmd.cli_ctx, ResourceType.MGMT_RESOURCE_TEMPLATESPECS, 'TemplateSpec', mod='models')
template_spec_parent = TemplateSpec(location=location, description=description, display_name=display_name, tags=None)
rcf.template_specs.create_or_update(resource_group_name, name, template_spec_parent)
if not Exists:
try: # Check if parent template spec already exists.
rcf.template_specs.get(resource_group_name=resource_group_name, template_spec_name=name)
except Exception: # pylint: disable=broad-except
TemplateSpec = get_sdk(cmd.cli_ctx, ResourceType.MGMT_RESOURCE_TEMPLATESPECS, 'TemplateSpec', mod='models')
template_spec_parent = TemplateSpec(location=location, description=description, display_name=display_name, tags=None)
rcf.template_specs.create_or_update(resource_group_name, name, template_spec_parent)

TemplateSpecVersion = get_sdk(cmd.cli_ctx, ResourceType.MGMT_RESOURCE_TEMPLATESPECS, 'TemplateSpecVersion', mod='models')
template_spec_child = TemplateSpecVersion(location=location, artifacts=artifacts, description=version_description, template=input_template, tags=None)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,54 @@ interactions:
- -g -n -v -l -f
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_template_specs000001/providers/Microsoft.Resources/templateSpecs/cli-test-list-template-spec000002/versions/1.0?api-version=2019-06-01-preview
response:
body:
string: '{"error":{"code":"ResourceNotFound","message":"The Resource ''Microsoft.Resources/templateSpecs/cli-test-list-template-spec000002/versions/1.0''
under resource group ''cli_test_template_specs000001'' was not found. For
more details please go to https://aka.ms/ARMResourceNotFoundFix"}}'
headers:
cache-control:
- no-cache
content-length:
- '354'
content-type:
- application/json; charset=utf-8
date:
- Mon, 12 Oct 2020 03:45:01 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
x-content-type-options:
- nosniff
x-ms-failure-cause:
- gateway
status:
code: 404
message: Not Found
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- ts create
Connection:
- keep-alive
ParameterSetName:
- -g -n -v -l -f
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: GET
Expand All @@ -32,7 +79,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 16 Sep 2020 14:15:56 GMT
- Mon, 12 Oct 2020 03:45:01 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -65,7 +112,7 @@ interactions:
- -g -n -v -l -f
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: PUT
Expand All @@ -74,8 +121,8 @@ interactions:
body:
string: "{\r\n \"location\": \"westus\",\r\n \"systemData\": {\r\n \"createdBy\":
\"[email protected]\",\r\n \"createdByType\": \"User\",\r\n \"createdAt\":
\"2020-09-16T14:15:57.4061382Z\",\r\n \"lastModifiedBy\": \"[email protected]\",\r\n
\ \"lastModifiedByType\": \"User\",\r\n \"lastModifiedAt\": \"2020-09-16T14:15:57.4061382Z\"\r\n
\"2020-10-12T03:45:03.2513917Z\",\r\n \"lastModifiedBy\": \"[email protected]\",\r\n
\ \"lastModifiedByType\": \"User\",\r\n \"lastModifiedAt\": \"2020-10-12T03:45:03.2513917Z\"\r\n
\ },\r\n \"properties\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_template_specs000001/providers/Microsoft.Resources/templateSpecs/cli-test-list-template-spec000002\",\r\n
\ \"type\": \"Microsoft.Resources/templateSpecs\",\r\n \"name\": \"cli-test-list-template-spec000002\"\r\n}"
headers:
Expand All @@ -86,7 +133,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 16 Sep 2020 14:15:57 GMT
- Mon, 12 Oct 2020 03:45:03 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -130,7 +177,7 @@ interactions:
- -g -n -v -l -f
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: PUT
Expand All @@ -139,8 +186,8 @@ interactions:
body:
string: "{\r\n \"location\": \"westus\",\r\n \"systemData\": {\r\n \"createdBy\":
\"[email protected]\",\r\n \"createdByType\": \"User\",\r\n \"createdAt\":
\"2020-09-16T14:15:58.6212032Z\",\r\n \"lastModifiedBy\": \"[email protected]\",\r\n
\ \"lastModifiedByType\": \"User\",\r\n \"lastModifiedAt\": \"2020-09-16T14:15:58.6212032Z\"\r\n
\"2020-10-12T03:45:04.3675163Z\",\r\n \"lastModifiedBy\": \"[email protected]\",\r\n
\ \"lastModifiedByType\": \"User\",\r\n \"lastModifiedAt\": \"2020-10-12T03:45:04.3675163Z\"\r\n
\ },\r\n \"properties\": {\r\n \"artifacts\": [],\r\n \"template\":
{\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n
\ \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {\r\n \"location\":
Expand All @@ -167,7 +214,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 16 Sep 2020 14:15:58 GMT
- Mon, 12 Oct 2020 03:45:04 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -198,7 +245,7 @@ interactions:
- --template-spec
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: GET
Expand All @@ -207,8 +254,8 @@ interactions:
body:
string: "{\r\n \"location\": \"westus\",\r\n \"systemData\": {\r\n \"createdBy\":
\"[email protected]\",\r\n \"createdByType\": \"User\",\r\n \"createdAt\":
\"2020-09-16T14:15:58.6212032Z\",\r\n \"lastModifiedBy\": \"[email protected]\",\r\n
\ \"lastModifiedByType\": \"User\",\r\n \"lastModifiedAt\": \"2020-09-16T14:15:58.6212032Z\"\r\n
\"2020-10-12T03:45:04.3675163Z\",\r\n \"lastModifiedBy\": \"[email protected]\",\r\n
\ \"lastModifiedByType\": \"User\",\r\n \"lastModifiedAt\": \"2020-10-12T03:45:04.3675163Z\"\r\n
\ },\r\n \"properties\": {\r\n \"artifacts\": [],\r\n \"template\":
{\r\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\r\n
\ \"contentVersion\": \"1.0.0.0\",\r\n \"parameters\": {\r\n \"location\":
Expand All @@ -235,7 +282,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 16 Sep 2020 14:15:58 GMT
- Mon, 12 Oct 2020 03:45:05 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -268,7 +315,7 @@ interactions:
- --template-spec
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: GET
Expand All @@ -277,8 +324,8 @@ interactions:
body:
string: "{\r\n \"location\": \"westus\",\r\n \"systemData\": {\r\n \"createdBy\":
\"[email protected]\",\r\n \"createdByType\": \"User\",\r\n \"createdAt\":
\"2020-09-16T14:15:57.4061382Z\",\r\n \"lastModifiedBy\": \"[email protected]\",\r\n
\ \"lastModifiedByType\": \"User\",\r\n \"lastModifiedAt\": \"2020-09-16T14:15:58.6212032Z\"\r\n
\"2020-10-12T03:45:03.2513917Z\",\r\n \"lastModifiedBy\": \"[email protected]\",\r\n
\ \"lastModifiedByType\": \"User\",\r\n \"lastModifiedAt\": \"2020-10-12T03:45:04.3675163Z\"\r\n
\ },\r\n \"properties\": {},\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_template_specs000001/providers/Microsoft.Resources/templateSpecs/cli-test-list-template-spec000002\",\r\n
\ \"type\": \"Microsoft.Resources/templateSpecs\",\r\n \"name\": \"cli-test-list-template-spec000002\"\r\n}"
headers:
Expand All @@ -289,7 +336,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 16 Sep 2020 14:15:59 GMT
- Mon, 12 Oct 2020 03:45:06 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -324,7 +371,7 @@ interactions:
- --template-spec --yes
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: DELETE
Expand All @@ -338,7 +385,7 @@ interactions:
content-length:
- '0'
date:
- Wed, 16 Sep 2020 14:16:00 GMT
- Mon, 12 Oct 2020 03:45:07 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -369,7 +416,7 @@ interactions:
- -g
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: GET
Expand All @@ -385,7 +432,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 16 Sep 2020 14:16:00 GMT
- Mon, 12 Oct 2020 03:45:07 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -416,7 +463,7 @@ interactions:
- --template-spec --yes
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: DELETE
Expand All @@ -428,7 +475,7 @@ interactions:
cache-control:
- no-cache
date:
- Wed, 16 Sep 2020 14:16:02 GMT
- Mon, 12 Oct 2020 03:45:08 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -457,7 +504,7 @@ interactions:
- -g
User-Agent:
- python/3.8.3 (Windows-10-10.0.19041-SP0) msrest/0.6.18 msrest_azure/0.6.3
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.12.0
azure-mgmt-resource/10.2.0 Azure-SDK-For-Python AZURECLI/2.13.0
accept-language:
- en-US
method: GET
Expand All @@ -473,7 +520,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Wed, 16 Sep 2020 14:16:01 GMT
- Mon, 12 Oct 2020 03:45:09 GMT
expires:
- '-1'
pragma:
Expand Down
Loading