saltstack/salt — pull request #7731 by vvoody (2013-10-10 14:45:50+00:00)
Title: salt-ssh: keep raw command to be executed remotely unexpanded

Hi, first of all. Please let me thank you for making such a great tool :D

If you use salt-ssh to execute some raw command, e.g.:

salt-ssh '*' -r 'ls ~'

This command intends to list remote users' home directory. Unfortunately, salt-ssh now will expand this command to:

sshpass -p PASSWORD ssh HOST SSH_opt1 SSH_opt2 ... ls ~

Look at the end part of line, tilde char will be expanded to $HOME, e.g. /home/vvoody. It's a normal bash behavior. But it's not we want obviously. There is may not 'vvoody' user existing on remote.

So the fix is simple, make the command to be executed on remote as a raw string. The example command will be like:

sshpass -p PASSWORD ssh HOST SSH_opt1 SSH_opt2 ... 'ls ~'