Fix windows tests suite breakage

This commit is contained in:
Daniel A Wozniak 2018-06-01 06:15:21 +00:00 committed by Daniel A. Wozniak
parent 215efa6b73
commit 118601ebd6
No known key found for this signature in database
GPG Key ID: 166B9D2C06C82D61
2 changed files with 4 additions and 2 deletions

View File

@ -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))

View File

@ -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]