mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix windows tests suite breakage
This commit is contained in:
parent
215efa6b73
commit
118601ebd6
2 changed files with 4 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue