systemd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package systemd implements integration between snappy interfaces and arbitrary systemd units that may be required for "oneshot" style tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend is responsible for maintaining apparmor profiles for ubuntu-core-launcher.

func (*Backend) Initialize

func (b *Backend) Initialize(opts *interfaces.SecurityBackendOptions) error

Initialize does nothing.

func (*Backend) Name

func (b *Backend) Name() interfaces.SecuritySystem

Name returns the name of the backend.

func (*Backend) NewSpecification

func (b *Backend) NewSpecification() interfaces.Specification

NewSpecification returns a new systemd specification.

func (*Backend) Remove

func (b *Backend) Remove(snapName string) error

Remove disables, stops and removes systemd services of a given snap.

func (*Backend) SandboxFeatures

func (b *Backend) SandboxFeatures() []string

SandboxFeatures returns nil

func (*Backend) Setup

func (b *Backend) Setup(snapInfo *snap.Info, confinement interfaces.ConfinementOptions, repo *interfaces.Repository, tm timings.Measurer) error

Setup creates and starts systemd services specific to a given snap.

This method should be called after changing plug, slots, connections between them or application present in the snap.

type Service

type Service struct {
	Description     string
	Type            string
	RemainAfterExit bool
	ExecStart       string
	ExecStop        string
}

Service describes a single systemd service file

func (*Service) String

func (s *Service) String() string

type Specification

type Specification struct {
	// contains filtered or unexported fields
}

Specification assists in collecting custom systemd services associated with an interface.

Unlike the Backend itself (which is stateless and non-persistent) this type holds internal state that is used by the systemd backend during the interface setup process.

func (*Specification) AddConnectedPlug

func (spec *Specification) AddConnectedPlug(iface interfaces.Interface, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error

AddConnectedPlug records systemd-specific side-effects of having a connected plug.

func (*Specification) AddConnectedSlot

func (spec *Specification) AddConnectedSlot(iface interfaces.Interface, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error

AddConnectedSlot records systemd-specific side-effects of having a connected slot.

func (*Specification) AddPermanentPlug

func (spec *Specification) AddPermanentPlug(iface interfaces.Interface, plug *snap.PlugInfo) error

AddPermanentPlug records systemd-specific side-effects of having a plug.

func (*Specification) AddPermanentSlot

func (spec *Specification) AddPermanentSlot(iface interfaces.Interface, slot *snap.SlotInfo) error

AddPermanentSlot records systemd-specific side-effects of having a slot.

func (*Specification) AddService

func (spec *Specification) AddService(distinctServiceSuffix string, s *Service) error

AddService adds a new systemd service unit. distinctServiceSuffix is used to name the service and needs to be unique. Different interfaces should use different suffixes and different plugs/slots should also use distinct ones. Uniqueness across snaps is taken care of implicitly elsewhere.

func (*Specification) Services

func (spec *Specification) Services() map[string]*Service

Services returns a deep copy of all the added services keyed by their service suffix.

Jump to

Keyboard shortcuts

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