upgrader

package
v0.0.0-...-2608902 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2016 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs an upgrader worker, using the resource names defined in the supplied config.

Types

type ManifoldConfig

type ManifoldConfig struct {
	AgentName            string
	APICallerName        string
	UpgradeStepsGateName string
	UpgradeCheckGateName string
	PreviousAgentVersion version.Number
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

type UpgradeReadyError

type UpgradeReadyError struct {
	AgentName string
	OldTools  version.Binary
	NewTools  version.Binary
	DataDir   string
}

UpgradeReadyError is returned by an Upgrader to report that an upgrade is ready to be performed and a restart is due.

func (*UpgradeReadyError) ChangeAgentTools

func (e *UpgradeReadyError) ChangeAgentTools() error

ChangeAgentTools does the actual agent upgrade. It should be called just before an agent exits, so that it will restart running the new tools.

func (*UpgradeReadyError) Error

func (e *UpgradeReadyError) Error() string

type Upgrader

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

Upgrader represents a worker that watches the state for upgrade requests.

func NewAgentUpgrader

func NewAgentUpgrader(
	st *upgrader.State,
	agentConfig agent.Config,
	origAgentVersion version.Number,
	upgradeStepsWaiter gate.Waiter,
	initialUpgradeCheckComplete gate.Unlocker,
) (*Upgrader, error)

NewAgentUpgrader returns a new upgrader worker. It watches changes to the current version of the current agent (with the given tag) and tries to download the tools for any new version into the given data directory. If an upgrade is needed, the worker will exit with an UpgradeReadyError holding details of the requested upgrade. The tools will have been downloaded and unpacked.

func (*Upgrader) Kill

func (u *Upgrader) Kill()

Kill implements worker.Worker.Kill.

func (*Upgrader) Stop

func (u *Upgrader) Stop() error

Stop stops the upgrader and returns any error it encountered when running.

func (*Upgrader) Wait

func (u *Upgrader) Wait() error

Wait implements worker.Worker.Wait.

Jump to

Keyboard shortcuts

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