Skip to content

Commit

Permalink
Merge pull request #56694 from terminalmage/bp-51470
Browse files Browse the repository at this point in the history
Port #51470 to master
  • Loading branch information
dwoz authored Apr 22, 2020
2 parents 08ad585 + 23c0a17 commit 1ce5f24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions salt/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions salt/utils/azurearm.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
UserPassCredentials,
ServicePrincipalCredentials,
)
from msrestazure.azure_active_directory import MSIAuthentication
from msrestazure.azure_cloud import (
MetadataEndpointError,
get_cloud_from_metadata_endpoint,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
)
)
Expand Down

0 comments on commit 1ce5f24

Please sign in to comment.