Skip to content

Commit

Permalink
{ACR} Migrate to Track 2 (#19006)
Browse files Browse the repository at this point in the history
* trackV2 fix

* trackv2 fix

* pylint fix
  • Loading branch information
rosanch authored Jul 29, 2021
1 parent ec1b15f commit 807c92e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
10 changes: 4 additions & 6 deletions src/azure-cli/azure/cli/command_modules/acr/scope_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,10 @@ def acr_scope_map_update(cmd,
description=description,
actions=current_actions
)
return client.begin_update(
resource_group_name,
registry_name,
scope_map_name,
scope_map_update_parameters
)
return client.begin_update(resource_group_name,
registry_name,
scope_map_name,
scope_map_update_parameters)


def acr_scope_map_show(cmd,
Expand Down
30 changes: 15 additions & 15 deletions src/azure-cli/azure/cli/command_modules/acr/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ def acr_task_create(cmd, # pylint: disable=too-many-locals
log_template=log_template,
is_system_task=is_system_task)
try:
return client.create(resource_group_name=resource_group_name,
registry_name=registry_name,
task_name=task_name,
task_create_parameters=task_create_parameters)
return client.begin_create(resource_group_name=resource_group_name,
registry_name=registry_name,
task_name=task_name,
task_create_parameters=task_create_parameters)
except ValidationError as e:
raise CLIError(e)

Expand Down Expand Up @@ -548,7 +548,7 @@ def acr_task_identity_assign(cmd,
identity=identity
)

return client.update(resource_group_name, registry_name, task_name, taskUpdateParameters)
return client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters)


def acr_task_identity_remove(cmd,
Expand Down Expand Up @@ -583,7 +583,7 @@ def acr_task_identity_remove(cmd,
identity=identity
)

return client.update(resource_group_name, registry_name, task_name, taskUpdateParameters)
return client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters)


def acr_task_identity_show(cmd,
Expand Down Expand Up @@ -632,7 +632,7 @@ def acr_task_credential_add(cmd,
)

resp = LongRunningOperation(cmd.cli_ctx)(
client.update(resource_group_name, registry_name, task_name, taskUpdateParameters)
client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters)
)
resp = resp.credentials
return {} if not resp else resp.custom_registries
Expand Down Expand Up @@ -671,7 +671,7 @@ def acr_task_credential_update(cmd,
)

resp = LongRunningOperation(cmd.cli_ctx)(
client.update(resource_group_name, registry_name, task_name, taskUpdateParameters)
client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters)
)
resp = resp.credentials
return {} if not resp else resp.custom_registries
Expand All @@ -696,7 +696,7 @@ def acr_task_credential_remove(cmd,
)

resp = LongRunningOperation(cmd.cli_ctx)(
client.update(resource_group_name, registry_name, task_name, taskUpdateParameters)
client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters)
)
resp = resp.credentials
return {} if not resp else resp.custom_registries
Expand Down Expand Up @@ -743,7 +743,7 @@ def acr_task_timer_add(cmd,
)
)

return client.update(resource_group_name, registry_name, task_name, taskUpdateParameters)
return client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters)


def acr_task_timer_update(cmd,
Expand Down Expand Up @@ -779,7 +779,7 @@ def acr_task_timer_update(cmd,
)
)

return client.update(resource_group_name, registry_name, task_name, taskUpdateParameters)
return client.begin_update(resource_group_name, registry_name, task_name, taskUpdateParameters)


def acr_task_timer_remove(cmd,
Expand All @@ -801,10 +801,10 @@ def acr_task_timer_remove(cmd,
existingTask.trigger.timer_triggers = trimmed_timer_triggers

try:
return client.create(resource_group_name=resource_group_name,
registry_name=registry_name,
task_name=task_name,
task_create_parameters=existingTask)
return client.begin_create(resource_group_name=resource_group_name,
registry_name=registry_name,
task_name=task_name,
task_create_parameters=existingTask)
except ValidationError as e:
raise CLIError(e)

Expand Down
6 changes: 3 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acr/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def acr_token_delete(cmd,
return None

resource_group_name = get_resource_group_name_by_registry_name(cmd.cli_ctx, registry_name, resource_group_name)
return client.delete(resource_group_name, registry_name, token_name)
return client.begin_delete(resource_group_name, registry_name, token_name)


def acr_token_update(cmd,
Expand All @@ -122,7 +122,7 @@ def acr_token_update(cmd,
arm_resource_id = get_resource_id_by_registry_name(cmd.cli_ctx, registry_name)
scope_map_id = '{}/{}/{}'.format(arm_resource_id, SCOPE_MAPS, scope_map_name)

return client.update(
return client.begin_update(
resource_group_name,
registry_name,
token_name,
Expand Down Expand Up @@ -239,7 +239,7 @@ def acr_token_credential_delete(cmd,
TokenUpdateParameters = cmd.get_models('TokenUpdateParameters')
TokenCredentialsProperties = cmd.get_models('TokenCredentialsProperties')

return client.update(
return client.begin_update(
resource_group_name,
registry_name,
token_name,
Expand Down

0 comments on commit 807c92e

Please sign in to comment.