Add additional path to find ssh.exe

This commit is contained in:
twangboy 2018-01-17 11:05:14 -07:00
parent 9c4fb42e5f
commit 0fa801a329
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB

View file

@ -9,6 +9,7 @@ import copy
import logging
import os
import re
import glob
from distutils.version import LooseVersion as _LooseVersion
# Import salt libs
@ -205,11 +206,15 @@ def _git_run(command, cwd=None, user=None, password=None, identity=None,
'git/ssh-id-wrapper'
)
if salt.utils.is_windows():
for suffix in ('', ' (x86)'):
ssh_exe = (
'C:\\Program Files{0}\\Git\\bin\\ssh.exe'
.format(suffix)
)
# Known locations for Git's ssh.exe in Windows
globmasks = [os.path.join(os.getenv('SystemDrive'), os.sep,
'Program Files*', 'Git', 'usr', 'bin',
'ssh.exe'),
os.path.join(os.getenv('SystemDrive'), os.sep,
'Program Files*', 'Git', 'bin',
'ssh.exe')]
for globmask in globmasks:
ssh_exe = glob.glob(globmask)
if os.path.isfile(ssh_exe):
env['GIT_SSH_EXE'] = ssh_exe
break