Documentation ¶
Overview ¶
Package systemd implements integration between snappy interfaces and arbitrary systemd units that may be required for "oneshot" style tasks.
Index ¶
- type Backend
- func (b *Backend) Initialize(opts *interfaces.SecurityBackendOptions) error
- func (b *Backend) Name() interfaces.SecuritySystem
- func (b *Backend) NewSpecification(*interfaces.SnapAppSet, interfaces.ConfinementOptions) interfaces.Specification
- func (b *Backend) Remove(snapName string) error
- func (b *Backend) SandboxFeatures() []string
- func (b *Backend) Setup(appSet *interfaces.SnapAppSet, opts interfaces.ConfinementOptions, ...) error
- type Service
- type Specification
- func (spec *Specification) AddConnectedPlug(iface interfaces.Interface, plug *interfaces.ConnectedPlug, ...) error
- func (spec *Specification) AddConnectedSlot(iface interfaces.Interface, plug *interfaces.ConnectedPlug, ...) error
- func (spec *Specification) AddPermanentPlug(iface interfaces.Interface, plug *snap.PlugInfo) error
- func (spec *Specification) AddPermanentSlot(iface interfaces.Interface, slot *snap.SlotInfo) error
- func (spec *Specification) AddService(distinctServiceSuffix string, s *Service) error
- func (spec *Specification) Services() map[string]*Service
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 special systemd units.
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.SnapAppSet, interfaces.ConfinementOptions) interfaces.Specification
NewSpecification returns a new systemd specification.
func (*Backend) SandboxFeatures ¶
SandboxFeatures returns nil
func (*Backend) Setup ¶
func (b *Backend) Setup(appSet *interfaces.SnapAppSet, opts 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
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.