Skip to content

Commit

Permalink
fix: dbus shutdown when it's not initialized
Browse files Browse the repository at this point in the history
If dbus is not started and a shutdown was called talos panics, fix by
checking if the mock is nil.

Signed-off-by: Noel Georgi <git@frezbo.dev>
  • Loading branch information
frezbo committed Feb 13, 2023
1 parent a7079ce commit 65d02e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/app/machined/pkg/runtime/v1alpha1/v1alpha1_dbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func (dbus *DBusState) Stop() error {

// WaitShutdown signals the shutdown over the D-Bus and waits for the inhibit lock to be released.
func (dbus *DBusState) WaitShutdown(ctx context.Context) error {
if dbus.logindMock == nil {
return nil
}

if err := dbus.logindMock.EmitShutdown(); err != nil {
return err
}
Expand Down

0 comments on commit 65d02e5

Please sign in to comment.