Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Control ¶
func Control(st *state.State, appInfos []*snap.AppInfo, inst *Instruction, flags *Flags, context *hookstate.Context) ([]*state.TaskSet, error)
Control creates a taskset for starting/stopping/restarting services via systemctl. The appInfos and inst define the services and the command to execute. Context is used to determine change conflicts - we will not conflict with tasks from same change as that of context's.
Types ¶
type Flags ¶
type Flags struct { // CreateExecCommandTasks tells Control method to create exec-command tasks // (alongside service-control tasks) for compatibility with old snapd. CreateExecCommandTasks bool }
Flags carries extra flags for Control
type Instruction ¶
type Instruction struct { Action string `json:"action"` Names []string `json:"names"` client.StartOptions client.StopOptions client.RestartOptions }
type ServiceAction ¶
type ServiceAction struct { SnapName string `json:"snap-name"` Action string `json:"action"` ActionModifier string `json:"action-modifier,omitempty"` Services []string `json:"services,omitempty"` }
ServiceAction encapsulates a single service-related action (such as starting, stopping or restarting) run against services of a given snap. The action is run for services listed in services attribute, or for all services of the snap if services list is empty. The names of services are app names (as defined in snap yaml).
type ServiceActionConflictError ¶
type ServiceActionConflictError struct {
// contains filtered or unexported fields
}
type ServiceManager ¶
type ServiceManager struct {
// contains filtered or unexported fields
}
ServiceManager is responsible for starting and stopping snap services.
func Manager ¶
func Manager(st *state.State, runner *state.TaskRunner) *ServiceManager
Manager returns a new service manager.
func (*ServiceManager) Ensure ¶
func (m *ServiceManager) Ensure() error
Ensure implements StateManager.Ensure.
type StatusDecorator ¶
type StatusDecorator struct {
// contains filtered or unexported fields
}
StatusDecorator supports decorating client.AppInfos with service status.
func NewStatusDecorator ¶
func NewStatusDecorator(rep interface { Notify(string) }) *StatusDecorator
NewStatusDecorator returns a new StatusDecorator.
func (*StatusDecorator) DecorateWithStatus ¶
DecorateWithStatus adds service status information to the given client.AppInfo associated with the given snap.AppInfo. If the snap is inactive or the app is not service it does nothing.