Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ func (h *Upgrade) Handle(ctx context.Context, a fleetapi.Action, ack acker.Acker
return fmt.Errorf("invalid type, expected ActionUpgrade and received %T", a)
}

asyncCtx, runAsync := h.getAsyncContext(ctx, a, ack)
if !runAsync {
return nil
}

// first send the action to any units that need to know of it
// and only when there is no error add the action in the h.bkgActions
// (through getAsyncContext) so it can be invoked
if h.tamperProtectionFn() {
// Find inputs that want to receive UPGRADE action
// Endpoint needs to receive a signed UPGRADE action in order to be able to uncontain itself
Expand All @@ -73,6 +71,11 @@ func (h *Upgrade) Handle(ctx context.Context, a fleetapi.Action, ack acker.Acker
}
}

asyncCtx, runAsync := h.getAsyncContext(ctx, a, ack)
if !runAsync {
return nil
}

go func() {
h.log.Infof("starting upgrade to version %s in background", action.Data.Version)
if err := h.coord.Upgrade(asyncCtx, action.Data.Version, action.Data.SourceURI, action, false, false); err != nil {
Expand Down
Loading