Skip to content

Commit 51b8804

Browse files
authored
[Cloud] az cloud register/update: Add upcoming breaking change announcement (#31097)
* Add upcoming breaking change announcement * update msg * typo * address comment
1 parent 6b28029 commit 51b8804

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# --------------------------------------------------------------------------------------------
5+
# pylint: disable=line-too-long
6+
7+
from azure.cli.core.breaking_change import AzCLIOtherChange, register_conditional_breaking_change
8+
9+
register_conditional_breaking_change(tag='CloudRegisterOutputBreakingChange',
10+
breaking_change=AzCLIOtherChange(cmd='cloud register',
11+
message='Starting from 2.73.0, no gallery endpoint will be returned if using endpoint discovery with --endpoint-resource-manager. Please manually set it with --endpoint-gallery.')
12+
)
13+
14+
register_conditional_breaking_change(tag='CloudUpdateOutputBreakingChange',
15+
breaking_change=AzCLIOtherChange(cmd='cloud update',
16+
message='Starting from 2.73.0, no gallery endpoint will be returned if using endpoint discovery with --endpoint-resource-manager. Please manually set it with --endpoint-gallery.')
17+
)

src/azure-cli/azure/cli/command_modules/cloud/custom.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _populate_from_metadata_endpoint(cloud, arm_endpoint, session=None):
6767
raise CLIError(error_msg_fmt.format(msg))
6868

6969

70-
def _build_cloud(cli_ctx, cloud_name, cloud_config=None, cloud_args=None):
70+
def _build_cloud(cli_ctx, cloud_name, cloud_config=None, is_update=False, cloud_args=None):
7171
from azure.cli.core.cloud import CloudEndpointNotSetException
7272
if cloud_config:
7373
# Using JSON format so convert the keys to snake case
@@ -98,6 +98,12 @@ def _build_cloud(cli_ctx, cloud_name, cloud_config=None, cloud_args=None):
9898
except CloudEndpointNotSetException:
9999
arm_endpoint = None
100100

101+
from azure.cli.core.breaking_change import print_conditional_breaking_change
102+
if arm_endpoint and is_update:
103+
print_conditional_breaking_change(cli_ctx, tag='CloudUpdateOutputBreakingChange')
104+
elif arm_endpoint:
105+
print_conditional_breaking_change(cli_ctx, tag='CloudRegisterOutputBreakingChange')
106+
101107
_populate_from_metadata_endpoint(c, arm_endpoint)
102108
required_endpoints = {'resource_manager': '--endpoint-resource-manager',
103109
'active_directory': '--endpoint-active-directory',
@@ -132,7 +138,7 @@ def register_cloud(cmd,
132138
suffix_azure_datalake_store_file_system_endpoint=None,
133139
suffix_azure_datalake_analytics_catalog_and_job_endpoint=None,
134140
suffix_acr_login_server_endpoint=None):
135-
c = _build_cloud(cmd.cli_ctx, cloud_name, cloud_config=cloud_config,
141+
c = _build_cloud(cmd.cli_ctx, cloud_name, cloud_config=cloud_config, is_update=False,
136142
cloud_args=locals())
137143
try:
138144
add_cloud(cmd.cli_ctx, c)
@@ -161,7 +167,7 @@ def modify_cloud(cmd,
161167
suffix_acr_login_server_endpoint=None):
162168
if not cloud_name:
163169
cloud_name = cmd.cli_ctx.cloud.name
164-
c = _build_cloud(cmd.cli_ctx, cloud_name, cloud_config=cloud_config,
170+
c = _build_cloud(cmd.cli_ctx, cloud_name, cloud_config=cloud_config, is_update=True,
165171
cloud_args=locals())
166172
try:
167173
update_cloud(cmd.cli_ctx, c)

0 commit comments

Comments
 (0)