Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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 @@ -893,7 +893,11 @@ def _prepare_deployment_properties_unmodified(cmd, deployment_scope, template_fi
template_obj = _remove_comments_from_json(_urlretrieve(template_uri).decode('utf-8'), file_path=template_uri)
elif template_spec:
template_link = TemplateLink(id=template_spec, mode="Incremental")
template_obj = show_resource(cmd=cmd, resource_ids=[template_spec]).properties['template']
resource = show_resource(cmd=cmd, resource_ids=[template_spec])

@zhoxing-ms zhoxing-ms Apr 28, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this logic is only for template_spec, could we specify the api-version to ResourceType.MGMT_RESOURCE_TEMPLATESPECS here? Otherwise, it will use the latest version and may be inconsistent with ResourceType.MGMT_RESOURCE_TEMPLATESPECS
In this way, we can ensure that the api-versions of all the rest requests for template_spec are consistent in the same profile

@zhoxing-ms zhoxing-ms Apr 28, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Such as:

from azure.cli.core.profiles import get_api_version
api_version = get_api_version(cli_ctx, ResourceType.MGMT_RESOURCE_TEMPLATESPECS)
template_obj = show_resource(cmd=cmd, resource_ids=[template_spec], api_version=api_version).properties['template']

try:
template_obj = resource.properties['mainTemplate']
except Exception: # pylint: disable=broad-except
template_obj = resource.properties['template']
else:
template_content = (
run_bicep_command(["build", "--stdout", template_file])
Expand Down
Loading