Skip to content

Commit

Permalink
Merge pull request #2882 from lorengordon/fix/salt-3006-1
Browse files Browse the repository at this point in the history
  • Loading branch information
lorengordon authored May 12, 2023
2 parents a7b3c54 + f7090e1 commit c67e8ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions src/watchmaker/workers/salt.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,12 +935,21 @@ def _get_salt_call():
"""Retrieve installation path for Salt if it exists."""
system_drive = os.environ['systemdrive']
program_files = os.environ['ProgramFiles']

new_salt_path = os.sep.join((program_files, 'Salt Project', 'Salt',
'salt-call.bat'))
old_salt_path = os.sep.join((system_drive, 'Salt', 'salt-call.bat'))
if os.path.isfile(new_salt_path):
return new_salt_path

new_salt_paths = [
os.sep.join(
(program_files, 'Salt Project', 'Salt', 'salt-call.exe')
),
os.sep.join(
(program_files, 'Salt Project', 'Salt', 'salt-call.bat')
),
]

for salt_path in new_salt_paths:
if os.path.isfile(salt_path):
return salt_path

return old_salt_path

def install(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_saltworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def test_windows_salt_call_old():
def test_windows_salt_call_new():
"""Ensure new path is tested."""
salt_path = os.sep.join(("C:\\Program Files", 'Salt Project',
'Salt', 'salt-call.bat'))
'Salt', 'salt-call.exe'))
assert SaltWindows._get_salt_call() == salt_path


Expand Down

0 comments on commit c67e8ef

Please sign in to comment.