mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Format pywintypes.error
This commit is contained in:
parent
9572aabb67
commit
c7cf5f6f70
@ -1133,9 +1133,14 @@ def get_name(principal):
|
||||
|
||||
try:
|
||||
return win32security.LookupAccountSid(None, sid_obj)[0]
|
||||
except (pywintypes.error, TypeError):
|
||||
raise CommandExecutionError(
|
||||
'Could not find User for {0}'.format(principal))
|
||||
except (pywintypes.error, TypeError) as exc:
|
||||
if type(exc) == pywintypes.error:
|
||||
win_error = win32api.FormatMessage(exc.winerror).rstrip('\n')
|
||||
message = 'Error resolving {0} ({1})'.format(principal, win_error)
|
||||
else:
|
||||
message = 'Error resolving {0}'.format(principal)
|
||||
|
||||
raise CommandExecutionError(message)
|
||||
|
||||
|
||||
def get_owner(obj_name):
|
||||
|
Loading…
Reference in New Issue
Block a user