diff --git a/cmd/run.go b/cmd/run.go index e827653c..e4393709 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -86,6 +86,7 @@ var runCmd = &cobra.Command{ if err := store.Load(); err != nil { logrus.Errorf("Ignoring the state file %s because of the loading error: %s", storeFilename, err) } + prometheus.Subscribe(broker, &metrics) metrics.SetBuildInfo(cmd.Version) // We get the last mainCommitId to avoid useless @@ -142,8 +143,6 @@ var runCmd = &cobra.Command{ srv := server.New(broker, manager, cfg.Grpc.UnixSocketPath) srv.Start() - prometheus.Subscribe(broker, &metrics) - manager.Run(cmd.Context()) }, } diff --git a/internal/manager/manager.go b/internal/manager/manager.go index e6bc1efd..d60fdf80 100644 --- a/internal/manager/manager.go +++ b/internal/manager/manager.go @@ -254,6 +254,10 @@ func (m *Manager) Run(ctx context.Context) { lastDpl := m.deployer.State().Deployment if lastDpl != nil { m.needToReboot = m.executor.NeedToReboot(lastDpl.Generation.OutPath, lastDpl.Operation) + if m.needToReboot { + e := &protobuf.Event_RebootRequired{Deployment: lastDpl} + m.broker.Publish(&protobuf.Event{Type: &protobuf.Event_RebootRequired_{RebootRequired: e}, CreatedAt: timestamppb.New(time.Now().UTC())}) + } } m.FetchAndBuild(ctx)