Bug #20071
closedCompliance incorrectly computed when two components have the same name and cfe vars are involved
Description
This is related to #19990 but perhaps it's older than that.
In the case when we have two components with the same name, and at least one of them has a cfengine variable, and all returned report values could match the variable, we count all matching cases for the variable, not removing the value from the other component.
We know that with current structure, it's undecidable in general case (typically, if there is two cfengine vars that convert to a .*
pattern), but here, we don't do the pairing that is tried in the old 6.2 cases (in recPairReports
).
Example:
Expected reports: - block1: "componentXXX", expected value: "${loop}" - block2: "componentXXX", expected value: "inBlock2" Reports: - "componentXXX", "loop1", success - "componentXXX", "loop2", success - "componentXXX", "loop3", success - "componentXXX", "inBlock2", error
In that case, componentXXX
in block2 will have its correct value with status error
.
But componentXXX
in block1 will ALSO have status error
with 4 reports, its own three loops and the one for blocks2.
Workaround¶
The workaround is easy: change the name for one of the component.
Correction¶
The only correct and definitive solution for that problem is to give each reprots an unique ID in expected reports and use that in compliance computation.