mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Fix windows tests suite breakage
This commit is contained in:
parent
215efa6b73
commit
118601ebd6
@ -119,7 +119,7 @@ def get_sid_from_name(name):
|
||||
return win32security.ConvertSidToStringSid(sid)
|
||||
|
||||
|
||||
def get_current_user():
|
||||
def get_current_user(with_domain=True):
|
||||
'''
|
||||
Gets the user executing the process
|
||||
|
||||
@ -136,6 +136,8 @@ def get_current_user():
|
||||
user_name = 'SYSTEM'
|
||||
elif get_sid_from_name(test_user) == 'S-1-5-18':
|
||||
user_name = 'SYSTEM'
|
||||
elif not with_domain:
|
||||
user_name = win32api.GetUserName()
|
||||
except pywintypes.error as exc:
|
||||
raise CommandExecutionError(
|
||||
'Failed to get current user: {0}'.format(exc.strerror))
|
||||
|
@ -1563,5 +1563,5 @@ def this_user():
|
||||
Get the user associated with the current process.
|
||||
'''
|
||||
if salt.utils.is_windows():
|
||||
return salt.utils.win_functions.get_current_user()
|
||||
return salt.utils.win_functions.get_current_user(with_domain=False)
|
||||
return pwd.getpwuid(os.getuid())[0]
|
||||
|
Loading…
Reference in New Issue
Block a user