mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #40357 from sergeizv/check-has-win32
Check salt.utils.win_functions.HAS_WIN32 in salt.utils.get_user
This commit is contained in:
commit
d3633cf8a2
@ -86,9 +86,9 @@ except ImportError:
|
||||
|
||||
try:
|
||||
import salt.utils.win_functions
|
||||
HAS_WIN32 = True
|
||||
HAS_WIN_FUNCTIONS = True
|
||||
except ImportError:
|
||||
HAS_WIN32 = False
|
||||
HAS_WIN_FUNCTIONS = False
|
||||
|
||||
try:
|
||||
import grp
|
||||
@ -290,7 +290,7 @@ def get_user():
|
||||
'''
|
||||
if HAS_PWD:
|
||||
return pwd.getpwuid(os.geteuid()).pw_name
|
||||
elif HAS_WIN32:
|
||||
elif HAS_WIN_FUNCTIONS and salt.utils.win_functions.HAS_WIN32:
|
||||
return salt.utils.win_functions.get_current_user()
|
||||
else:
|
||||
raise CommandExecutionError("Required external libraries not found. Need 'pwd' or 'win32api")
|
||||
|
Loading…
Reference in New Issue
Block a user