engine: resources: Rename var

More accurate.
This commit is contained in:
James Shubin
2024-01-16 15:37:43 -05:00
parent 9e70f53afa
commit 6b4fb434da

View File

@@ -239,7 +239,7 @@ func (obj *KVRes) CheckApply(ctx context.Context, apply bool) (bool, error) {
return false, errwrap.Wrapf(err, "check error during StrGet")
}
if value, ok := keyMap[hostname]; ok && obj.Value != nil {
if value, exists := keyMap[hostname]; exists && obj.Value != nil {
if value == *obj.Value {
return true, nil
}
@@ -250,10 +250,10 @@ func (obj *KVRes) CheckApply(ctx context.Context, apply bool) (bool, error) {
return true, nil
}
} else if !ok && obj.Value == nil {
} else if !exists && obj.Value == nil {
return true, nil // nothing to delete, we're good!
} else if ok && obj.Value == nil { // delete
} else if exists && obj.Value == nil { // delete
if !apply {
return false, nil
}