inertia: Index | Files | Directories

package runner

import ""

Package runner provides the Inertia client's low-level SSH command runner


Package Files

doc.go ssh.go

type SSHOptions Uses

type SSHOptions struct {
    KeyPassphrase string

SSHOptions denotes options for the SSH runner

type SSHRunner Uses

type SSHRunner struct {
    // contains filtered or unexported fields

SSHRunner runs commands over SSH and captures results.

go:generate go run -o ./mocks/session.go ./ssh.go SSHSession

func NewSSHRunner Uses

func NewSSHRunner(ip string, cfg *cfg.SSH, opts SSHOptions) *SSHRunner

NewSSHRunner returns a new SSHRunner

func (*SSHRunner) CopyFile Uses

func (r *SSHRunner) CopyFile(file io.Reader, remotePath string, permissions string) error

CopyFile copies given reader to remote

func (*SSHRunner) Run Uses

func (r *SSHRunner) Run(cmd string) (cmdout *bytes.Buffer, cmderr *bytes.Buffer, err error)

Run runs a command remotely.

func (*SSHRunner) RunSession Uses

func (r *SSHRunner) RunSession(commands ...string) error

RunSession sets up a SSH shell to the remote

func (*SSHRunner) RunStream Uses

func (r *SSHRunner) RunStream(cmd string, interactive bool) error

RunStream remotely executes given command, streaming its output and opening up an optionally interactive session

type SSHSession Uses

type SSHSession interface {
    Run(cmd string) (*bytes.Buffer, *bytes.Buffer, error)
    RunStream(cmd string, interactive bool) error
    RunSession(commands ...string) error
    CopyFile(f io.Reader, remotePath string, permissions string) error

SSHSession can run remote commands over SSH


mocksPackage mocks provides mocked implmentations of interfaces in client/runner

Package runner imports 9 packages (graph) and is imported by 8 packages. Updated 2021-01-28. Refresh now. Tools for package owners.