sshcommand

package
v0.0.0-...-8357b5a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSHCommandResult

type SSHCommandResult struct {
	SSHOutput string
	Err       error
}

SSHCommandResult is the result of executing a command via SSH. Upon success the Err wil be nil, upon failure, the Err will be set, and the SSHOutput may also be set, depending on the failure. Using this instead of returning (string, error) from SSHCommand() makes the code much cleaner and simpler when calling SSHCommand() asynchronously with a channel.

func SSHCommand

func SSHCommand(command, sshAddrStr, user, hostPrivateKeyPath string) *SSHCommandResult

SSHCommand Executes a command on a remote host via ssh. For the ssh to work, the ssh privateKey from the test executor has to have already been added to the ~/.ssh/authorized_keys file on the remote host. The format of sshAddrStr is "192.168.10.3:22".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL