Documentation
¶
Index ¶
- Constants
- Variables
- func IsRunning() bool
- func ListCommand() string
- func ListServices() ([]string, error)
- func ServiceLimits(conf common.Conf) []*unit.UnitOption
- func SysdReload() error
- func UnitSerialize(opts []*unit.UnitOption) io.Reader
- type Cmdline
- type DBusAPI
- type DBusAPIFactory
- type FileSystemOps
- type Service
- func (s Service) Conf() common.Conf
- func (s *Service) Exists() (bool, error)
- func (s *Service) Install() error
- func (s *Service) InstallCommands() ([]string, error)
- func (s *Service) Installed() (bool, error)
- func (s Service) Name() string
- func (s *Service) Remove() error
- func (s *Service) Running() (bool, error)
- func (s *Service) Start() error
- func (s *Service) StartCommands() ([]string, error)
- func (s *Service) Stop() error
- func (s *Service) WriteService() error
- type ShimExec
Constants ¶
const ( LibSystemdDir = "/lib/systemd/system" EtcSystemdDir = "/etc/systemd/system" EtcSystemdMultiUserDir = EtcSystemdDir + "/multi-user.target.wants" )
Variables ¶
var NewDBusAPI = func() (DBusAPI, error) { return dbus.New() }
Functions ¶
func IsRunning ¶
func IsRunning() bool
IsRunning returns whether or not systemd is the local init system.
func ListCommand ¶
func ListCommand() string
ListCommand returns a command that will list the services on a host.
func ListServices ¶
ListServices returns the list of installed service names.
func ServiceLimits ¶
func ServiceLimits(conf common.Conf) []*unit.UnitOption
ServiceLimits converts the limits in conf to systemd unit options.
func UnitSerialize ¶
func UnitSerialize(opts []*unit.UnitOption) io.Reader
UnitSerialize encodes all of the given UnitOption objects into a unit file. Renamed from Serialize from github.com/coreos/go-systemd/unit so as to not conflict with the exported internal function in export_test.go.
Types ¶
type Cmdline ¶
type Cmdline struct {
// contains filtered or unexported fields
}
Cmdline exposes the core operations of interacting with systemd units.
type DBusAPI ¶
type DBusAPI interface { Close() ListUnits() ([]dbus.UnitStatus, error) StartUnit(string, string, chan<- string) (int, error) StopUnit(string, string, chan<- string) (int, error) LinkUnitFiles([]string, bool, bool) ([]dbus.LinkUnitFileChange, error) EnableUnitFiles([]string, bool, bool) (bool, []dbus.EnableUnitFileChange, error) DisableUnitFiles([]string, bool) ([]dbus.DisableUnitFileChange, error) GetUnitProperties(string) (map[string]interface{}, error) GetUnitTypeProperties(string, string) (map[string]interface{}, error) Reload() error }
DBusAPI describes all the systemd API methods needed by juju.
type DBusAPIFactory ¶
Type alias for a DBusAPI factory method.
type FileSystemOps ¶
type FileSystemOps interface { Remove(name string) error RemoveAll(name string) error WriteFile(fileName string, data []byte, perm os.FileMode) error }
FileSystemOps describes file-system operations required to install and remove a service.
type Service ¶
type Service struct { common.Service ConfName string UnitName string DirName string FallBackDirName string Script []byte // contains filtered or unexported fields }
Service provides visibility into and control over a systemd service.
func NewService ¶
func NewService( name string, conf common.Conf, dataDir string, newDBus DBusAPIFactory, fileOps FileSystemOps, fallBackDirName string, ) (*Service, error)
NewService returns a new reference to an object that implements the Service interface for systemd.
func NewServiceWithDefaults ¶
NewServiceWithDefaults returns a new systemd service reference populated with sensible defaults.
func (*Service) InstallCommands ¶
InstallCommands implements Service.
func (*Service) StartCommands ¶
StartCommands implements Service.
func (*Service) WriteService ¶
WriteService (UpgradableService) writes a systemd unit file for the service and ensures that it is linked and enabled by systemd.
type ShimExec ¶
type ShimExec interface {
RunCommands(args exec.RunParams) (*exec.ExecResponse, error)
}
ShimExec is used to indirect command-line interactions. A mock for this is "patched" over the the listed methods by the test suite. This should be phased out in favour of the fileSystemOps approach below.