upgradeseries

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

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

Go to latest
Published: Feb 15, 2019 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 upgrade-series worker, using the resource names defined in the supplied config.

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

NewWorker creates, starts and returns a new upgrade-series worker based on the input configuration.

Types

type AgentService

type AgentService interface {
	Running() (bool, error)
	Start() error
	Stop() error
}

AgentService is a service managed by the local init system, for running a unit agent.

type Config

type Config struct {
	// FacadeFactory is used to acquire back-end state with
	// the input tag context.
	FacadeFactory func(names.Tag) Facade

	// Logger is the logger for this worker.
	Logger Logger

	// Tag is the current machine tag.
	Tag names.Tag

	// ServiceAccess provides access to the local init system.
	Service ServiceAccess

	// UpgraderFactory is a factory method that will return an upgrader capable
	// of handling service and agent binary manipulation for a
	// runtime-determined target OS series.
	UpgraderFactory func(string) (Upgrader, error)
}

Config is the configuration needed to construct an UpgradeSeries worker.

func (Config) Validate

func (config Config) Validate() error

Validate validates the upgrade-series worker configuration.

type Facade

type Facade interface {
	// Getters
	WatchUpgradeSeriesNotifications() (watcher.NotifyWatcher, error)
	MachineStatus() (model.UpgradeSeriesStatus, error)
	UnitsPrepared() ([]names.UnitTag, error)
	UnitsCompleted() ([]names.UnitTag, error)
	TargetSeries() (string, error)

	// Setters
	StartUnitCompletion(reason string) error
	SetMachineStatus(status model.UpgradeSeriesStatus, reason string) error
	FinishUpgradeSeries(string) error
	PinMachineApplications() (map[string]error, error)
	UnpinMachineApplications() (map[string]error, error)
}

Facade exposes the API surface required by the upgrade-series worker.

func NewFacade

func NewFacade(apiCaller base.APICaller, tag names.Tag) Facade

NewFacade creates a *upgradeseries.Client and returns it as a Facade.

type Logger

type Logger interface {
	Debugf(message string, args ...interface{})
	Infof(message string, args ...interface{})
	Warningf(message string, args ...interface{})
	Errorf(message string, args ...interface{})
}

Logger represents the methods required to emit log messages.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string

	Logger    Logger
	NewFacade func(base.APICaller, names.Tag) Facade
	NewWorker func(Config) (worker.Worker, error)
}

ManifoldConfig holds the information necessary for the dependency engine to to run an upgrade-series worker.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

type ServiceAccess

type ServiceAccess interface {
	// ListServices returns a slice of service
	// names known by the local init system.
	ListServices() ([]string, error)

	// DiscoverService returns a service implementation
	// based on the input service name and config.
	DiscoverService(string) (AgentService, error)
}

ServiceAccess describes methods for interacting with the local init system.

type Upgrader

type Upgrader interface {
	PerformUpgrade() error
}

Upgrader describes methods required to perform file-system manipulation in preparation for upgrading the host Ubuntu version.

func NewUpgrader

func NewUpgrader(toSeries string, manager service.SystemdServiceManager, logger Logger) (Upgrader, error)

NewUpgrader uses the input function to determine the series that should be supported, and returns a reference to a new Upgrader that supports it.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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