Skip to content

Commit

Permalink
Merge pull request #47917 from dwoz/winsuite
Browse files Browse the repository at this point in the history
Fix windows tests suite breakage
  • Loading branch information
gtmanfred committed Jun 1, 2018
2 parents 63efb76 + 118601e commit 735e920
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion salt/utils/win_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion tests/support/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

0 comments on commit 735e920

Please sign in to comment.