Fix server_id grain in PY3 on Windows

https://github.com/saltstack/salt/pull/46649 caused a regression on
Windows since the executable path does not exist. This fixes that grain
on Windows by using `sys.executable`.
This commit is contained in:
Erik Johnson 2018-04-11 11:33:12 -05:00
parent 74d70e95a5
commit cb0cf89ed3
No known key found for this signature in database
GPG key ID: 5E5583C437808F3F

View file

@ -2411,9 +2411,8 @@ def get_server_id():
if py_ver >= (3, 3):
# Python 3.3 enabled hash randomization, so we need to shell out to get
# a reliable hash.
py_bin = 'python{0}.{1}'.format(*py_ver)
id_hash = __salt__['cmd.run'](
[py_bin, '-c', 'print(hash("{0}"))'.format(id_)],
[sys.executable, '-c', 'print(hash("{0}"))'.format(id_)],
env={'PYTHONHASHSEED': '0'}
)
try: