Пример #1
0
func NewConnection() (Systemd, error) {
	conn, err := dbus.New()
	if err != nil {
		return NewStubSystemd(), err
	}
	return conn, nil
}
Пример #2
0
func NewEventListener() (*EventListener, error) {
	e := EventListener{}
	var err error

	e.conn, err = dbus.New()
	if err != nil {
		return nil, err
	}

	err = e.conn.Subscribe()
	if err != nil {
		return nil, err
	}

	e.lastEvent = make(map[containers.Identifier]EventType)

	return &e, nil
}