juju: github.com/juju/juju/worker/upgrader Index | Files

package upgrader

import "github.com/juju/juju/worker/upgrader"


Package Files

error.go manifold.go upgrader.go

func AllowedTargetVersion Uses

func AllowedTargetVersion(
    origAgentVersion version.Number,
    curVersion version.Number,
    upgradeStepsRunning bool,
    targetVersion version.Number,
) bool

AllowedTargetVersion checks if targetVersion is too different from curVersion to allow a downgrade.

func Manifold Uses

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.

type Config Uses

type Config struct {
    State                       *upgrader.State
    AgentConfig                 agent.Config
    OrigAgentVersion            version.Number
    UpgradeStepsWaiter          gate.Waiter
    InitialUpgradeCheckComplete gate.Unlocker
    CheckDiskSpace              func(string, uint64) error

Config contains the items the worker needs to start.

type ManifoldConfig Uses

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 Uses

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 Uses

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 Uses

func (e *UpgradeReadyError) Error() string

type Upgrader Uses

type Upgrader struct {
    // contains filtered or unexported fields

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

func NewAgentUpgrader Uses

func NewAgentUpgrader(config Config) (*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 Uses

func (u *Upgrader) Kill()

Kill implements worker.Worker.Kill.

func (*Upgrader) Stop Uses

func (u *Upgrader) Stop() error

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

func (*Upgrader) Wait Uses

func (u *Upgrader) Wait() error

Wait implements worker.Worker.Wait.

Package upgrader imports 22 packages (graph) and is imported by 164 packages. Updated 2020-01-16. Refresh now. Tools for package owners.