balena-supervisor/gosuper/systemd/systemd.go
Lorenzo Stoakes 849a8c848b Prevent non-fatal errors from closing the supervisor.
This patch fixes a couple of cases where `log.Fatalf` would cause the supervisor
to exit immediately when it's inappropriate to do so. `log.Fatalf` and
co. should not be used unless the supervisor utterly cannot run without
whatever's being checked being in place.

This patch also adjusts the code that relied on the module's values being
created here being available, they now check and send an appropriate error
message if they're not there.
2015-10-15 18:14:42 +01:00

26 lines
565 B
Go

package systemd
import (
"log"
"resin-supervisor/gosuper/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus"
"resin-supervisor/gosuper/Godeps/_workspace/src/github.com/coreos/go-systemd/login1"
)
var (
// Logind Systemd Login1 connection
Logind *login1.Conn
// Dbus Systems Dbus connection
Dbus *dbus.Conn
)
func init() {
var err error
if Logind, err = login1.New(); err != nil {
log.Printf("Failed to connect to host system bus: %s", err)
}
if Dbus, err = dbus.New(); err != nil {
log.Printf("Failed to connect to host DBUS: %s", err)
}
}