diff --git a/linter_exclusions.yml b/linter_exclusions.yml index cd7d1ee0506..444667c011e 100644 --- a/linter_exclusions.yml +++ b/linter_exclusions.yml @@ -100,11 +100,17 @@ acr pack build: - no_positional_parameters acr replication create: parameters: + global_endpoint_routing: + rule_exclusions: + - option_length_too_long region_endpoint_enabled: rule_exclusions: - option_length_too_long acr replication update: parameters: + global_endpoint_routing: + rule_exclusions: + - option_length_too_long region_endpoint_enabled: rule_exclusions: - option_length_too_long diff --git a/src/azure-cli/azure/cli/command_modules/acr/_breaking_change.py b/src/azure-cli/azure/cli/command_modules/acr/_breaking_change.py index de98a89bdc6..b96d1654675 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/_breaking_change.py +++ b/src/azure-cli/azure/cli/command_modules/acr/_breaking_change.py @@ -4,6 +4,7 @@ # -------------------------------------------------------------------------------------------- from azure.cli.core.breaking_change import ( + register_argument_deprecate, register_command_group_deprecate, register_logic_breaking_change ) @@ -41,3 +42,8 @@ detail='The `--status enabled` parameter will no longer be accepted and will result in ' 'an error due to Docker Content Trust deprecation.', doc_link='https://aka.ms/acr/dctdeprecation') + +register_argument_deprecate('acr replication create', '--region-endpoint-enabled', + redirect='--global-endpoint-routing') +register_argument_deprecate('acr replication update', '--region-endpoint-enabled', + redirect='--global-endpoint-routing') diff --git a/src/azure-cli/azure/cli/command_modules/acr/_params.py b/src/azure-cli/azure/cli/command_modules/acr/_params.py index fbbffdf384c..9aadeaebb3e 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/_params.py +++ b/src/azure-cli/azure/cli/command_modules/acr/_params.py @@ -299,12 +299,14 @@ def load_arguments(self, _): # pylint: disable=too-many-statements c.argument('replication_name', help='The name of the replication. Default to the location name.', completer=None) for scope in ['acr replication create', 'acr replication update']: - help_str = "Allow routing to this replication. Requests will not be routed to a disabled replication." \ - " Data syncing will continue regardless of the region endpoint status." + help_str = "Allow routing to this replication via the registry global endpoint. If disabled, requests" \ + " to the global endpoint will not be routed to the replica. Data syncing to the replica" \ + " will continue regardless of the global endpoint routing status." help_str += ' Default: true.' if 'create' in scope else '' # suffix help with default if command is for create with self.argument_context(scope) as c: - c.argument('region_endpoint_enabled', arg_type=get_three_state_flag(), help=help_str, is_preview=True) + c.argument('region_endpoint_enabled', arg_type=get_three_state_flag(), help=help_str) + c.argument('global_endpoint_routing', arg_type=get_three_state_flag(), help=help_str) with self.argument_context('acr run') as c: c.argument('registry_name', options_list=['--registry', '-r']) diff --git a/src/azure-cli/azure/cli/command_modules/acr/replication.py b/src/azure-cli/azure/cli/command_modules/acr/replication.py index 5a8f047b94d..3ef9f1cc4a7 100644 --- a/src/azure-cli/azure/cli/command_modules/acr/replication.py +++ b/src/azure-cli/azure/cli/command_modules/acr/replication.py @@ -30,11 +30,16 @@ def acr_replication_create(cmd, resource_group_name=None, replication_name=None, region_endpoint_enabled=None, + global_endpoint_routing=None, zone_redundancy=None, tags=None): registry, resource_group_name = validate_premium_registry( cmd, registry_name, resource_group_name, REPLICATIONS_NOT_SUPPORTED) + # --global-endpoint-routing takes precedence over deprecated --region-endpoint-enabled + if global_endpoint_routing is not None: + region_endpoint_enabled = global_endpoint_routing + normalized_location = "".join(location.split()).lower() if registry.location == normalized_location: raise CLIError('Replication could not be created in the same location as the registry.') @@ -80,12 +85,15 @@ def acr_replication_show(cmd, return client.get(resource_group_name, registry_name, replication_name) -def acr_replication_update_custom(instance, region_endpoint_enabled=None, tags=None): +def acr_replication_update_custom(instance, region_endpoint_enabled=None, global_endpoint_routing=None, tags=None): if tags is not None: instance.tags = tags - if region_endpoint_enabled is not None: - instance.region_endpoint_enabled = region_endpoint_enabled + # --global-endpoint-routing takes precedence over deprecated --region-endpoint-enabled + effective_value = global_endpoint_routing if global_endpoint_routing is not None \ + else region_endpoint_enabled + if effective_value is not None: + instance.region_endpoint_enabled = effective_value return instance