ssh

package
v0.0.0-...-8cfe922 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ssh implements various CoreOS and etcd related commands executed via SSH.

By default a shellout to ssh is done, which utilizes the users ssh-agent and normal ssh configuration.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultExecutor is an SSHShellExecutor with some default values.
	DefaultExecutor = &SSHShellExecutor{
		Username: "core",
		Binary:   "ssh",
	}
)

Functions

func GetEtcd2MemberName

func GetEtcd2MemberName(host string) (string, error)

GetEtcd2MemberName connects to the given host and returns the name of the given host in the etcd2 quorum. This assumes the member has "name=<machine-id>" set.

func GetEtcdDiscoveryUrl

func GetEtcdDiscoveryUrl(host string) (string, error)

GetEtcdDiscoveryUrl connects to the given host and extracts the used etcd discovery URL.

func GetMachineID

func GetMachineID(host string) (string, error)

GetMachineID connects to the given host and returns the content of /etc/machine-id.

func RemoveFromEtcd

func RemoveFromEtcd(host string) error

RemoveFromEtcd connects to the given host and removes it from the etcd discovery.

Utilizes GetMachineID()

func RunRemoteCommand

func RunRemoteCommand(host, command string) (string, error)

RunRemoteCommand executes the given command using the DefaultExecutor.

func StopEtcd

func StopEtcd(host string) error

StopEtcd connects to the given host and stops the etcd2 daemon running.

Types

type Executor

type Executor interface {
	RunRemoteCommand(host, command string) (string, error)
}

Executor is responsible for executing the given command on the given host and returning its output.

type SSHShellExecutor

type SSHShellExecutor struct {
	Binary   string
	Username string
}

SSHShellExecutor provides an Executor using os.Exec to utilize the command line tool ssh.

func (*SSHShellExecutor) RunRemoteCommand

func (ssh *SSHShellExecutor) RunRemoteCommand(host, command string) (string, error)

RunRemoteCommand connects to the given host and runs the command, returning any output.

Jump to

Keyboard shortcuts

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