Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions src/azure-cli/azure/cli/command_modules/acr/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ def acr_build(cmd, # pylint: disable=too-many-locals

platform_os, platform_arch, platform_variant = get_validate_platform(cmd, platform)

DockerBuildRequest, PlatformProperties = cmd.get_models('DockerBuildRequest', 'PlatformProperties')
DockerBuildRequest, PlatformProperties = cmd.get_models(
'DockerBuildRequest',
'PlatformProperties',
operation_group='runs')

docker_build_request = DockerBuildRequest(
agent_pool_name=agent_pool_name,
image_names=image_names,
Expand All @@ -119,7 +123,7 @@ def acr_build(cmd, # pylint: disable=too-many-locals
log_template=log_template
)

queued = LongRunningOperation(cmd.cli_ctx)(client_registries.schedule_run(
queued = LongRunningOperation(cmd.cli_ctx)(client_registries.begin_schedule_run(
resource_group_name=resource_group_name,
registry_name=registry_name,
run_request=docker_build_request))
Expand Down
34 changes: 17 additions & 17 deletions src/azure-cli/azure/cli/command_modules/acr/connected_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def acr_connected_registry_create(cmd, # pylint: disable=too-many-locals, too-m
"Enabling the data endpoint might affect your firewall rules.\nTo enable data endpoint run:" +
"\n\taz acr update -n {} --data-endpoint-enabled true".format(registry_name))

ErrorResponseException = cmd.get_models('ErrorResponseException')
from azure.core.exceptions import HttpResponseError as ErrorResponseException
Copy link
Member

Choose a reason for hiding this comment

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

Is the type same as before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically, yes. Track2 SDK has removed all these Exceptions in models.

parent = None
mode = mode.capitalize()
if parent_name:
Expand Down Expand Up @@ -129,11 +129,11 @@ def acr_connected_registry_create(cmd, # pylint: disable=too-many-locals, too-m
)

try:
return client.create(subscription_id=subscription_id,
resource_group_name=resource_group_name,
registry_name=registry_name,
connected_registry_name=connected_registry_name,
connected_registry_create_parameters=connected_registry_create_parameters)
return client.begin_create(subscription_id=subscription_id,
Copy link
Member

Choose a reason for hiding this comment

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

why do you need to change the code from xyz to begin_xyz? What is the difference between the two?

Copy link
Member

@jsntcy jsntcy Jul 9, 2021

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refer to this Guide

resource_group_name=resource_group_name,
registry_name=registry_name,
connected_registry_name=connected_registry_name,
connected_registry_create_parameters=connected_registry_create_parameters)
except ValidationError as e:
raise CLIError(e)

Expand Down Expand Up @@ -202,10 +202,10 @@ def acr_connected_registry_update(cmd, # pylint: disable=too-many-locals, too-m
)

try:
return client.update(resource_group_name=resource_group_name,
registry_name=registry_name,
connected_registry_name=connected_registry_name,
connected_registry_update_parameters=connected_registry_update_parameters)
return client.begin_update(resource_group_name=resource_group_name,
registry_name=registry_name,
connected_registry_name=connected_registry_name,
connected_registry_update_parameters=connected_registry_update_parameters)
except ValidationError as e:
raise CLIError(e)

Expand All @@ -224,7 +224,7 @@ def acr_connected_registry_delete(cmd,
try:
connected_registry = acr_connected_registry_show(
cmd, client, connected_registry_name, registry_name, resource_group_name)
result = client.delete(resource_group_name, registry_name, connected_registry_name)
result = client.begin_delete(resource_group_name, registry_name, connected_registry_name)
sync_token = get_token_from_id(cmd, connected_registry.parent.sync_properties.token_id)
sync_token_name = sync_token.name
sync_scope_map_name = sync_token.scope_map_id.split('/scopeMaps/')[1]
Expand Down Expand Up @@ -268,10 +268,10 @@ def acr_connected_registry_deactivate(cmd,

user_confirmation("Are you sure you want to deactivate the connected registry '{}' in '{}'?".format(
connected_registry_name, registry_name), yes)
return client.deactivate(subscription_id=subscription_id,
resource_group_name=resource_group_name,
registry_name=registry_name,
connected_registry_name=connected_registry_name)
return client.begin_deactivate(subscription_id=subscription_id,
resource_group_name=resource_group_name,
registry_name=registry_name,
connected_registry_name=connected_registry_name)


def acr_connected_registry_list(cmd,
Expand Down Expand Up @@ -355,7 +355,7 @@ def _create_sync_token(cmd,
sync_token_name = SYNC_TOKEN_NAME.format(connected_registry_name)
logger.warning("If sync token '%s' already exists, it properties will be overwritten", sync_token_name)
Token = cmd.get_models('Token')
poller = token_client.create(
poller = token_client.begin_create(
resource_group_name,
registry_name,
sync_token_name,
Expand Down Expand Up @@ -520,7 +520,7 @@ def _update_repo_permissions(cmd,
return None
current_actions = list(final_actions_set)
logger.warning(msg)
return scope_map_client.update(
return scope_map_client.begin_update(
resource_group_name,
registry_name,
sync_scope_map_name,
Expand Down
9 changes: 6 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acr/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def acr_pack_build(cmd, # pylint: disable=too-many-locals
raise CLIError('Building with Buildpacks requires a valid source location.')

platform_os, platform_arch, platform_variant = get_validate_platform(cmd, platform)
OS = cmd.get_models('OS')
OS = cmd.get_models('OS', operation_group='task_runs')
if platform_os != OS.linux.value.lower():
raise CLIError('Building with Buildpacks is only supported on Linux.')

Expand All @@ -74,7 +74,10 @@ def acr_pack_build(cmd, # pylint: disable=too-many-locals
pack_image_tag=pack_image_tag,
no_pull='--no-pull' if not pull else '')

EncodedTaskRunRequest, PlatformProperties = cmd.get_models('EncodedTaskRunRequest', 'PlatformProperties')
EncodedTaskRunRequest, PlatformProperties = cmd.get_models(
'EncodedTaskRunRequest',
'PlatformProperties',
operation_group='task_runs')

request = EncodedTaskRunRequest(
encoded_task_content=base64.b64encode(yaml_body.encode()).decode(),
Expand All @@ -92,7 +95,7 @@ def acr_pack_build(cmd, # pylint: disable=too-many-locals
agent_pool_name=agent_pool_name
)

queued = LongRunningOperation(cmd.cli_ctx)(client_registries.schedule_run(
queued = LongRunningOperation(cmd.cli_ctx)(client_registries.begin_schedule_run(
resource_group_name=resource_group_name,
registry_name=registry_name,
run_request=request))
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/acr/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def acr_run(cmd, # pylint: disable=too-many-locals
platform_os, platform_arch, platform_variant = get_validate_platform(cmd, platform)

EncodedTaskRunRequest, FileTaskRunRequest, PlatformProperties = cmd.get_models(
'EncodedTaskRunRequest', 'FileTaskRunRequest', 'PlatformProperties')
'EncodedTaskRunRequest', 'FileTaskRunRequest', 'PlatformProperties', operation_group='runs')

if source_location:
request = FileTaskRunRequest(
Expand Down Expand Up @@ -100,7 +100,7 @@ def acr_run(cmd, # pylint: disable=too-many-locals
log_template=log_template
)

queued = LongRunningOperation(cmd.cli_ctx)(client_registries.schedule_run(
queued = LongRunningOperation(cmd.cli_ctx)(client_registries.begin_schedule_run(
resource_group_name=resource_group_name,
registry_name=registry_name,
run_request=request))
Expand Down