in internal/goalstate/goalstate.go [50:80]
func ReportFinalStatusForImmediateGoalState(ctx *log.Context, notifier *observer.Notifier, goalStateKey types.GoalStateKey, statusType types.StatusType, instanceview *types.RunCommandInstanceView) error {
if notifier == nil {
return errors.New("notifier is nil. Cannot report status to HGAP")
}
cmd, ok := commands.Cmds[enableCommand]
if !ok {
return errors.New("missing enable command")
}
if !cmd.ShouldReportStatus {
ctx.Log("status", "status not reported for operation (by design)")
return nil
}
msg, err := instanceview.Marshal()
if err != nil {
return errors.Wrapf(err, "failed to marshal instance view")
}
statusItem, err := status.GetSingleStatusItem(ctx, statusType, cmd, string(msg))
if err != nil {
return errors.Wrap(err, "failed to get status item")
}
ctx.Log("message", "reporting status of skipped goal state by notifying the observer to then send to HGAP")
return notifier.Notify(types.StatusEventArgs{
StatusKey: goalStateKey,
TopLevelStatus: statusItem,
})
}