mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 14:13:08 +00:00
849a8c848b
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.
26 lines
565 B
Go
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)
|
|
}
|
|
}
|