Merge pull request #47917 from dwoz/winsuite

Fix windows tests suite breakage
This commit is contained in:
Daniel Wallace 2018-06-01 06:42:14 -05:00 committed by GitHub
commit 735e92093e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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]