Skip to content

Commit 6e72170

Browse files
committed
fix
1 parent fad3d10 commit 6e72170

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

  • src/azure-cli/azure/cli/command_modules/serviceconnector

‎src/azure-cli/azure/cli/command_modules/serviceconnector/custom.py‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -534,18 +534,19 @@ def connection_create_func(cmd, client, # pylint: disable=too-many-locals,too-m
534534
'manually and then create the connection.'.format(str(e)))
535535

536536
validate_service_state(parameters)
537-
try:
538-
linker = todict(client.get(resource_uri=source_id, linker_name=connection_name))
539-
if linker is not None and linker.get('provisioningState') == 'Accepted':
540-
logger.warning('Connection provisioningState is Accepted, please retry later to avoid conflict.')
541-
return linker
542-
if linker is not None and linker.get('provisioningState') == 'Succeeded' and \
543-
not compare_properties_changed(parameters, linker) and no_recreate:
544-
logger.warning(
545-
'Connection exists and no property to be updated, skip the update operation.')
546-
return linker
547-
except Exception as e:
548-
logger.debug('No existing connection, start creating a new one. Error: %s', e)
537+
if no_recreate:
538+
try:
539+
linker = todict(client.get(resource_uri=source_id, linker_name=connection_name))
540+
if linker is not None and linker.get('provisioningState') == 'Accepted':
541+
logger.warning('Connection provisioningState is Accepted, please retry later to avoid conflict.')
542+
return linker
543+
if linker is not None and linker.get('provisioningState') == 'Succeeded' and \
544+
not compare_properties_changed(parameters, linker):
545+
logger.warning(
546+
'Connection exists and no property to be updated, skip the update operation.')
547+
return linker
548+
except Exception as e:
549+
logger.debug('No existing connection, start creating a new one. Error: %s', e)
549550

550551
if enable_mi_for_db_linker and auth_action != 'optOutAllAuth':
551552
new_auth_info = enable_mi_for_db_linker(

0 commit comments

Comments
 (0)