diff --git a/plugin/deploy/ssh.go b/plugin/deploy/ssh.go index 0799dd88..0a9653a4 100644 --- a/plugin/deploy/ssh.go +++ b/plugin/deploy/ssh.go @@ -81,7 +81,7 @@ func (s *SSH) Write(f *buildfile.Buildfile) { } if len(s.Cmd) > 0 { - sshCmd := "ssh -o StrictHostKeyChecking=no -p %s %s %s" + sshCmd := "ssh -o StrictHostKeyChecking=no -p %s %s \"%s\"" f.WriteCmd(fmt.Sprintf(sshCmd, host[1], strings.SplitN(host[0], ":", 2)[0], s.Cmd)) } } diff --git a/plugin/deploy/ssh_test.go b/plugin/deploy/ssh_test.go index 581f15cc..037d3ab3 100644 --- a/plugin/deploy/ssh_test.go +++ b/plugin/deploy/ssh_test.go @@ -70,7 +70,7 @@ func TestSSHNoArtifact(t *testing.T) { t.Error("Expect script not to contains scp command") } - if !strings.Contains(bscr, "ssh -o StrictHostKeyChecking=no -p 22 user@test.example.com /opt/bin/redeploy.sh") { + if !strings.Contains(bscr, "ssh -o StrictHostKeyChecking=no -p 22 user@test.example.com \"/opt/bin/redeploy.sh\"") { t.Error("Expect script to contains ssh command") } }