core: Fix ignore_changes = all
The initial rework of this function to support traversals didn't correctly handle the "all" case, due to a logic error where the ignoreAll branch could be visited only if ignoreChanges were non-empty, but yet the two are mutually exclusive in practice. Now we process ignoreAll separately from ignoreChanges, and invert the two loops so that we will visit all attributes regardless of what is in the ignoreChanges slice.
This commit is contained in:
parent
3f4b7f847d
commit
559f65bf3d
|
@ -254,10 +254,14 @@ func (n *EvalDiff) processIgnoreChanges(diff *InstanceDiff) error {
|
|||
|
||||
// get the complete set of keys we want to ignore
|
||||
ignorableAttrKeys := make(map[string]bool)
|
||||
for _, ignoredTraversal := range ignoreChanges {
|
||||
ignoredKey := legacyFlatmapKeyForTraversal(ignoredTraversal)
|
||||
for k := range attrs {
|
||||
if ignoreAll || strings.HasPrefix(k, ignoredKey) {
|
||||
for k := range attrs {
|
||||
if ignoreAll {
|
||||
ignorableAttrKeys[k] = true
|
||||
continue
|
||||
}
|
||||
for _, ignoredTraversal := range ignoreChanges {
|
||||
ignoredKey := legacyFlatmapKeyForTraversal(ignoredTraversal)
|
||||
if k == ignoredKey || strings.HasPrefix(k, ignoredKey+".") {
|
||||
ignorableAttrKeys[k] = true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue