This seems to be an interaction between ssh and parameters passed to it. By using a list, we are properly passing it as a single argument, but then ssh passes it to the next shell as a plain string.
It happens on the command line as well:
ssh juju python -c "import sys; print sys.argv" fo bar bar
sys.argv fo bar bar
File "<string>", line 1
import
^
SyntaxError: invalid syntax
versus:
ssh juju python -c "'import sys; print sys.argv'" fo bar bar
['-c', 'fo', 'bar', 'bar']
I wish there was a better way, since this would have problems if there was a ", etc. But I guess as a workaround for how ssh invokes the remote shell, it is all we can really do. I'll merge it.
This seems to be an interaction between ssh and parameters passed to it. By using a list, we are properly passing it as a single argument, but then ssh passes it to the next shell as a plain string.
It happens on the command line as well:
ssh juju python -c "import sys; print sys.argv" fo bar bar
sys.argv fo bar bar
File "<string>", line 1
import
^
SyntaxError: invalid syntax
versus:
ssh juju python -c "'import sys; print sys.argv'" fo bar bar
['-c', 'fo', 'bar', 'bar']
I wish there was a better way, since this would have problems if there was a ", etc. But I guess as a workaround for how ssh invokes the remote shell, it is all we can really do. I'll merge it.