runner

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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	jujuc.Context
	Id() string
	HookVars(paths context.Paths) ([]string, error)
	ActionData() (*context.ActionData, error)
	SetProcess(process context.HookProcess)
	HasExecutionSetUnitStatus() bool
	ResetExecutionSetUnitStatus()

	Prepare() error
	Flush(badge string, failure error) error
}

Context exposes hooks.Context, and additional methods needed by Runner.

type Factory

type Factory interface {

	// NewCommandRunner returns an execution context suitable for running
	// an arbitrary script.
	NewCommandRunner(commandInfo context.CommandInfo) (Runner, error)

	// NewHookRunner returns an execution context suitable for running the
	// supplied hook definition (which must be valid).
	NewHookRunner(hookInfo hook.Info) (Runner, error)

	// NewActionRunner returns an execution context suitable for running the
	// action identified by the supplied id.
	NewActionRunner(actionId string) (Runner, error)
}

Factory represents a long-lived object that can create runners relevant to a specific unit.

func NewFactory

func NewFactory(
	state *uniter.State,
	paths context.Paths,
	contextFactory context.ContextFactory,
) (
	Factory, error,
)

NewFactory returns a Factory capable of creating runners for executing charm hooks, actions and commands.

type Runner

type Runner interface {

	// Context returns the context against which the runner executes.
	Context() Context

	// RunHook executes the hook with the supplied name.
	RunHook(name string) error

	// RunAction executes the action with the supplied name.
	RunAction(name string) error

	// RunCommands executes the supplied script.
	RunCommands(commands string) (*utilexec.ExecResponse, error)
}

Runner is responsible for invoking commands in a context.

func NewRunner

func NewRunner(context Context, paths context.Paths) Runner

NewRunner returns a Runner backed by the supplied context and paths.

Directories

Path Synopsis
Package context contains the ContextFactory and Context definitions.
Package context contains the ContextFactory and Context definitions.
The worker/uniter/runner/jujuc package implements the server side of the jujuc proxy tool, which forwards command invocations to the unit agent process so that they can be executed against specific state.
The worker/uniter/runner/jujuc package implements the server side of the jujuc proxy tool, which forwards command invocations to the unit agent process so that they can be executed against specific state.

Jump to

Keyboard shortcuts

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