@@ -109,23 +109,24 @@ def validate_registry_name(cmd, namespace):
109109 if registry is None :
110110 return
111111 suffixes = cmd .cli_ctx .cloud .suffixes
112+ dnl_hash = registry .find ("-" )
113+
114+ if dnl_hash > 0 :
115+ logger .warning (
116+ "Registry name is %s. The following suffix '%s' is automatically omitted." ,
117+ registry [:dnl_hash ],
118+ registry [dnl_hash :])
119+ namespace .registry_name = registry [:dnl_hash ]
112120 # Some clouds do not define 'acr_login_server_endpoint' (e.g. AzureGermanCloud)
113- if registry and hasattr (suffixes , 'acr_login_server_endpoint' ):
121+ elif hasattr (suffixes , 'acr_login_server_endpoint' ):
114122 acr_suffix = suffixes .acr_login_server_endpoint
115123 pos = registry .find (acr_suffix )
116124 if pos > 0 :
117- logger .warning ("The login server endpoint suffix '%s' is automatically omitted." , acr_suffix )
125+ logger .warning ("Registry name is %s. The following suffix '%s' is automatically omitted." ,
126+ registry [:pos ],
127+ acr_suffix )
118128 namespace .registry_name = registry [:pos ]
119129 registry = registry [:pos ]
120- # If registry contains '-' due to Domain Name Label Scope,
121- # ex: "myregistry-dnlhash123.azurecr.io", strip "-dnlhash123"
122- dnl_hash = registry .find ("-" )
123- if registry and dnl_hash > 0 :
124- logger .warning (
125- "The domain name label suffix '%s' is automatically omitted. Registry name is %s." ,
126- registry [dnl_hash :],
127- registry [:dnl_hash ])
128- namespace .registry_name = registry [:dnl_hash ]
129130
130131 registry = namespace .registry_name
131132 if not re .match (ACR_NAME_VALIDATION_REGEX , registry ):
0 commit comments