Skip to content
Permalink
Browse files

Add Timeout parameter for the SSH connection

  • Loading branch information...
FlorianSW committed Feb 21, 2019
1 parent 346b71f commit 33737941c544cfb472e44e008fe768f622201730
Showing with 6 additions and 1 deletion.
  1. +1 −0 internal/models/models.go
  2. +5 −1 internal/ssh/ssh.go
@@ -7,6 +7,7 @@ type Source struct {
User string `json:"user"`
Password string `json:"password"`
PrivateKey string `json:"private_key"`
Timeout int `json:"timeout"`
}

// Version is breadcrumb for Concourse CI to choose
@@ -50,7 +50,11 @@ func PerformSSHCommand(fs afero.Fs, source *models.Source, params *models.Params
}

command := fmt.Sprintf("%s %s", interpreter, remoteScriptFileName)
stdoutChan, stderrChan, doneChan, errChan, err := config.Stream(command, defaultTimeout)
timeout := defaultTimeout
if source.Timeout != 0 {
timeout = source.Timeout
}
stdoutChan, stderrChan, doneChan, errChan, err := config.Stream(command, timeout)
if err != nil {
return hierr.Errorf(err, "unable to run script on remote machine")
}

0 comments on commit 3373794

Please sign in to comment.
You can’t perform that action at this time.