Skip to content

Commit 39fd5f8

Browse files
{Compute} az image builder create: Migrate command to aaz-based implementation (#32864)
1 parent 52d20bc commit 39fd5f8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/azure-cli/azure/cli/command_modules/vm/_image_builder.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from azure.cli.core.commands.validators import get_default_location_from_resource_group, validate_tags
2828
from azure.cli.core.azclierror import RequiredArgumentMissingError, ResourceNotFoundError
2929

30-
from azure.cli.command_modules.vm._client_factory import _compute_client_factory
3130
from azure.cli.command_modules.vm._validators import _get_resource_id
3231

3332
logger = get_logger(__name__)
@@ -284,10 +283,16 @@ def process_image_template_create_namespace(cmd, namespace): # pylint: disable=
284283

285284
# 5 - check if source is an existing managed disk image resource
286285
if not source:
287-
compute_client = _compute_client_factory(cmd.cli_ctx)
288286
try:
287+
from .aaz.latest.image import Show as ImageShow
288+
command_args = {
289+
'image_name': namespace.source,
290+
'resource_group': namespace.resource_group_name
291+
}
292+
293+
# Purpose of calling ImageShow is just to check its existence
294+
ImageShow(cli_ctx=cmd.cli_ctx)(command_args=command_args)
289295
image_name = namespace.source
290-
compute_client.images.get(namespace.resource_group_name, namespace.source)
291296
namespace.source = _get_resource_id(cmd.cli_ctx, namespace.source, namespace.resource_group_name,
292297
'images', 'Microsoft.Compute')
293298
source = {

0 commit comments

Comments
 (0)