rename the 'stateok' return value to 'checkok'
The naming was confusing because the boolean return value expresses whether the resource needed changing (the check failed) as opposed to the state not being not OK. purpleidea note: The "stateok" (now properly renamed to "checkok") is actually the historical bool return value of the Check() -> bool function which is now part of the CheckApply() amalgamation. This is an easy way to think about it if you're trying to understand why at the end of a successful apply we return false, nil.
This commit is contained in:
10
pgraph.go
10
pgraph.go
@@ -729,15 +729,15 @@ func (g *Graph) Process(v *Vertex) {
|
||||
|
||||
obj.SetState(resStateCheckApply)
|
||||
// if this fails, don't UpdateTimestamp()
|
||||
stateok, err := obj.CheckApply(true)
|
||||
if stateok && err != nil { // should never return this way
|
||||
log.Fatalf("%v[%v]: CheckApply(): %t, %+v", obj.Kind(), obj.GetName(), stateok, err)
|
||||
checkok, err := obj.CheckApply(true)
|
||||
if checkok && err != nil { // should never return this way
|
||||
log.Fatalf("%v[%v]: CheckApply(): %t, %+v", obj.Kind(), obj.GetName(), checkok, err)
|
||||
}
|
||||
if DEBUG {
|
||||
log.Printf("%v[%v]: CheckApply(): %t, %v", obj.Kind(), obj.GetName(), stateok, err)
|
||||
log.Printf("%v[%v]: CheckApply(): %t, %v", obj.Kind(), obj.GetName(), checkok, err)
|
||||
}
|
||||
|
||||
if !stateok { // if state *was* not ok, we had to have apply'ed
|
||||
if !checkok { // if state *was* not ok, we had to have apply'ed
|
||||
if err != nil { // error during check or apply
|
||||
ok = false
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user