diff --git a/salt/cloud/__init__.py b/salt/cloud/__init__.py index a2ae81445dbf..3006bf6f5b8e 100644 --- a/salt/cloud/__init__.py +++ b/salt/cloud/__init__.py @@ -79,6 +79,11 @@ def _call(queue, args, kwargs): queue.put("ERROR") queue.put("Exception") queue.put("{0}\n{1}\n".format(ex, trace)) + except SystemExit as ex: + trace = traceback.format_exc() + queue.put("ERROR") + queue.put("System exit") + queue.put("{0}\n{1}\n".format(ex, trace)) return ret return _call diff --git a/salt/utils/azurearm.py b/salt/utils/azurearm.py index 2dbcfe4ec6cf..96055aa9c433 100644 --- a/salt/utils/azurearm.py +++ b/salt/utils/azurearm.py @@ -47,7 +47,6 @@ UserPassCredentials, ServicePrincipalCredentials, ) - from msrestazure.azure_active_directory import MSIAuthentication from msrestazure.azure_cloud import ( MetadataEndpointError, get_cloud_from_metadata_endpoint, @@ -123,7 +122,14 @@ def _determine_auth(**kwargs): kwargs["username"], kwargs["password"], cloud_environment=cloud_env ) elif "subscription_id" in kwargs: - credentials = MSIAuthentication(cloud_environment=cloud_env) + try: + from msrestazure.azure_active_directory import MSIAuthentication + + credentials = MSIAuthentication(cloud_environment=cloud_env) + except ImportError: + raise SaltSystemExit( + msg="MSI authentication support not availabe (requires msrestazure >= 0.4.14)" + ) else: raise SaltInvocationError( @@ -161,7 +167,7 @@ def get_client(client_type, **kwargs): if client_type not in client_map: raise SaltSystemExit( - "The Azure ARM client_type {0} specified can not be found.".format( + msg="The Azure ARM client_type {0} specified can not be found.".format( client_type ) )