machineactions

package
Version: v0.0.0-...-3d7d6b0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: AGPL-3.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunAsUser = "ubuntu"

RunAsUser is the user that the machine juju-exec action is executed as.

Functions

func HandleAction

func HandleAction(name string, params map[string]interface{}) (results map[string]interface{}, err error)

HandleAction receives a name and a map of parameters for a given machine action. It will handle that action in a specific way and return a results map suitable for ActionFinish.

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold as configured.

func NewMachineActionsWorker

func NewMachineActionsWorker(config WorkerConfig) (worker.Worker, error)

NewMachineActionsWorker returns a worker.Worker that watches for actions enqueued on this machine and tries to execute them.

Types

type Facade

type Facade interface {
	WatchActionNotifications(agent names.MachineTag) (watcher.StringsWatcher, error)
	RunningActions(agent names.MachineTag) ([]params.ActionResult, error)

	Action(names.ActionTag) (*machineactions.Action, error)
	ActionBegin(names.ActionTag) error
	ActionFinish(tag names.ActionTag, status string, results map[string]interface{}, message string) error
}

Facade defines the capabilities required by the worker from the API.

func NewFacade

func NewFacade(apiCaller base.APICaller) Facade

NewFacade creates a Facade from a base.APICaller. It's a sensible value for ManifoldConfig.NewFacade.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string
	MachineLock   machinelock.Lock

	NewFacade func(base.APICaller) Facade
	NewWorker func(WorkerConfig) (worker.Worker, error)
}

ManifoldConfig describes the dependencies of a machine action runner.

type WorkerConfig

type WorkerConfig struct {
	Facade       Facade
	MachineTag   names.MachineTag
	MachineLock  machinelock.Lock
	HandleAction func(name string, params map[string]interface{}) (results map[string]interface{}, err error)
}

WorkerConfig defines the worker's dependencies.

func (WorkerConfig) Validate

func (c WorkerConfig) Validate() error

Validate returns an error if the configuration is not complete.

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL