machine

package
Version: v0.0.0-...-cf0b7a1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ControllerNodeForReplicaSetMember

func ControllerNodeForReplicaSetMember(member core.ReplicaSetMember) core.ControllerNode

ControllerNodeForReplicaSetMember returns ControllerNode for ReplicaSetMember.

Types

type CommandRunner

type CommandRunner interface {
	// All strings within the command must be individually passed-in.
	// For example,
	//     to run 'echo hi:D', pass in "echo", "hi:D",
	//     to stop juju-db, pass in "systemctl", "stop", "juju-db".
	Run(commands ...string) (string, error)
	RunScript(script string, args ...string) (string, error)
}

CommandRunner defines what is needed to run a command on a machine.

func NewLocalRunner

func NewLocalRunner() CommandRunner

NewLocalRunner constructs a command runner that runs commands locally.

func NewRemoteRunner

func NewRemoteRunner(ip string) CommandRunner

NewRemoteRunner constructs a command runner that runs commands remotely using ssh.

type Machine

type Machine struct {
	// contains filtered or unexported fields
}

Machine represents a juju controller machine and holds a runner for running commands on that machine (whether it's the current machine or a different one).

func New

func New(ip string, jujuID string, runner CommandRunner) *Machine

New returns a machine that satisfies core.ControllerNode.

func (*Machine) IP

func (m *Machine) IP() string

IP implements ControllerNode.IP.

func (*Machine) Ping

func (m *Machine) Ping() error

Ping implements ControllerNode.Ping() by ssh'ing into the machine and executing an 'echo' command.

func (*Machine) StartAgent

func (m *Machine) StartAgent() error

StartAgent implements ControllerNode.StartAgent.

func (*Machine) StopAgent

func (m *Machine) StopAgent() error

StopAgent implements ControllerNode.StopAgent.

func (*Machine) String

func (m *Machine) String() string

String reports "machine n (ip)".

func (*Machine) UpdateAgentVersion

func (m *Machine) UpdateAgentVersion(targetVersion version.Number) error

UpdateAgentVersion edits the agent.conf and updates the symlink to point to the tools for the specified version.

Jump to

Keyboard shortcuts

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