in pkg/intent/intent.go [99:133]
func (i *Intent) Stuck() bool {
// The end of the state machine has been reached.
exhausted := i.Terminal() && i.Realized()
// A step failed during and may not be able to be tried without taking
// intervening action.
failure := i.Errored()
// The actions reached a static position, but are unable to be driven by the
// state machine's steps.
degradedStatic := !i.Waiting() && (exhausted || failure)
// The actions were transitioned to unknown handling and waiting for
// instructions.
stuckUnknown := i.inUnknownState() && !i.InProgress()
wantingUnknown := i.Wanted == marker.NodeActionUnknown && i.Waiting()
degradedUnknown := stuckUnknown || wantingUnknown
// The action's step was out of line and resulted in an taking an unknown
// action.
degradedPath := i.DegradedPath() && i.Waiting()
// The action was not one of progress and yet was acted upon.
degradedBusy := !i.isInProgress(i.Wanted) && i.Wanted == i.Active && i.State == marker.NodeStateBusy
result := degradedStatic || degradedUnknown || degradedPath || degradedBusy
if logging.Debuggable {
logging.New("intent").WithFields(logrus.Fields{
"intent": i.DisplayString(),
"degradedStatic": degradedStatic,
"degradedUnknown": degradedUnknown,
"degradedPath": degradedPath,
"degradedBusy": degradedBusy,
"result": result,
}).Debug("intent:Stuck")
}
return result
}