Bug #20124
closedDuplicated expected reports leads to bad compliance for technique with blocks
Added by Nicolas CHARLES about 3 years ago. Updated about 3 years ago.
Description
Summary: a technique with blocks and components (with same name?) at different places leads to false compliance because expected reports are not correctly computed: each component get expected reports for all components with the same name.
It is not #20071 because here, the problem is located when the expected reports are generated, not when the pairing between expected reports and node reports is done. Here, the pairing is OK*, but not for the correct data.
- (actually, not that much OK since we use several time the same reports at differnt places. Here, it's #20071 at fault).
my technique is like this
and the reporting is
Since on root level of the technique there is a "File absent" component, all reports based on "File absent" are also added to the root method
same for "Command execution" on the root level
In "first block", the file absent of both itself and the inner block show up also
Compliance historized says
root | 2021-10-14 08:20:36+00 | 32377fd7-02fd-43d0-aab7-28460a91347b | b82d103a-6da6-4a5e-bb49-616d9fd9ac22 | 0 | 6 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
so 6 success and 3 repaired, for only 5 components
Files
clipboard-202110131449-3iewz.png (174 KB) clipboard-202110131449-3iewz.png | Nicolas CHARLES, 2021-10-13 14:49 | ||
clipboard-202110131450-pzw6g.png (59.8 KB) clipboard-202110131450-pzw6g.png | Nicolas CHARLES, 2021-10-13 14:50 |
Updated by Nicolas CHARLES about 3 years ago
- Subject changed from duplicated reports in UI with blocks in technique editor to duplicated reports with blocks in technique editor
- Description updated (diff)
Updated by Nicolas CHARLES about 3 years ago
compliance for API is
{ "action": "getNodeComplianceId", "result": "success", "data": { "nodes": [ { "id": "root", "name": "server.rudder.local", "compliance": 100, "mode": "full-compliance", "complianceDetails": { "successAlreadyOK": 70, "successRepaired": 30 }, "rules": [ { "id": "32377fd7-02fd-43d0-aab7-28460a91347b", "name": "Global configuration for all nodes", "compliance": 100, "complianceDetails": { "successAlreadyOK": 70, "successRepaired": 30 }, "directives": [ { "id": "63ca2068-f925-46e7-a3f7-158215dbef7c", "name": "MOTD and pre-login banner", "compliance": 100, "complianceDetails": { "successAlreadyOK": 100 }, "components": [ { "name": "MOTD Configuration", "compliance": 100, "complianceDetails": { "successAlreadyOK": 100 }, "values": [ { "value": "None", "reports": [ { "status": "successAlreadyOK", "message": "The MOTD file was correct" } ] } ] } ] }, { "id": "b82d103a-6da6-4a5e-bb49-616d9fd9ac22", "name": "technique avec des block", "compliance": 100, "complianceDetails": { "successAlreadyOK": 66.67, "successRepaired": 33.33 }, "components": [ { "name": "First block", "compliance": 100, "complianceDetails": { "successAlreadyOK": 75, "successRepaired": 25 }, "components": [ { "name": "inner block", "compliance": 100, "complianceDetails": { "successAlreadyOK": 50, "successRepaired": 50 }, "components": [ { "name": "Command execution", "compliance": 100, "complianceDetails": { "successRepaired": 100 }, "values": [ { "value": "/bin/true", "reports": [ { "status": "successRepaired", "message": "Execute the command /bin/true was repaired" } ] } ] }, { "name": "File absent", "compliance": 100, "complianceDetails": { "successAlreadyOK": 100 }, "values": [ { "value": "/tmp/bobby", "reports": [ { "status": "successAlreadyOK", "message": "Remove file /tmp/bobby was correct" } ] } ] } ] }, { "name": "File absent", "compliance": 100, "complianceDetails": { "successAlreadyOK": 100 }, "values": [ { "value": "/tmp/blob", "reports": [ { "status": "successAlreadyOK", "message": "Remove file /tmp/blob was correct" } ] }, { "value": "/tmp/bobby", "reports": [ { "status": "successAlreadyOK", "message": "Remove file /tmp/bobby was correct" } ] } ] } ] }, { "name": "Command execution", "compliance": 100, "complianceDetails": { "successRepaired": 100 }, "values": [ { "value": "/bin/true #bob", "reports": [ { "status": "successRepaired", "message": "Execute the command /bin/true #bob was repaired" } ] }, { "value": "/bin/true", "reports": [ { "status": "successRepaired", "message": "Execute the command /bin/true was repaired" } ] } ] }, { "name": "File absent", "compliance": 100, "complianceDetails": { "successAlreadyOK": 100 }, "values": [ { "value": "/tmp/morane", "reports": [ { "status": "successAlreadyOK", "message": "Remove file /tmp/morane was correct" } ] }, { "value": "/tmp/blob", "reports": [ { "status": "successAlreadyOK", "message": "Remove file /tmp/blob was correct" } ] }, { "value": "/tmp/bobby", "reports": [ { "status": "successAlreadyOK", "message": "Remove file /tmp/bobby was correct" } ] } ] } ] } ] } ] } ] } }
Updated by Nicolas CHARLES about 3 years ago
Cause is that we don't correctly generated the expected reports
{"directiveId":"b82d103a-6da6-4a5e-bb49-616d9fd9ac22","isSystem":false,"components": [ {"componentName":"First block","reportingLogic":"sum","subComponents": [ {"componentName":"inner block","reportingLogic":"sum", "subComponents": [ {"componentName":"Command execution","values":["/bin/true"],"unexpanded":["/bin/true"]} ,{"componentName":"File absent","values":["/tmp/bobby"],"unexpanded":["/tmp/bobby"]} ] } ,{"componentName":"File absent","values":["/tmp/bobby","/tmp/blob"],"unexpanded":["/tmp/bobby","/tmp/blob"]} ] } ,{"componentName":"Command execution","values":["/bin/true #bob","/bin/true"],"unexpanded":["/bin/true #bob","/bin/true"]} ,{"componentName":"File absent","values":["/tmp/bobby","/tmp/blob","/tmp/morane"],"unexpanded":["/tmp/bobby","/tmp/blob","/tmp/morane"]}]}]}
Updated by François ARMAND about 3 years ago
- Subject changed from duplicated reports with blocks in technique editor to Duplicated reports leads to bad compliance for technique with blocks
- Description updated (diff)
Updated by Nicolas CHARLES about 3 years ago
- Status changed from New to In progress
- Assignee set to Nicolas CHARLES
Updated by Nicolas CHARLES about 3 years ago
Work in progess here: https://github.com/ncharles/rudder/commit/00dde138996e27bdf69371bc85a225c2a4b89f2b
Updated by Nicolas CHARLES about 3 years ago
- in sectionToExpectedReports, if it's a block, it looks if the parents of the expected vars contains the current section. So it will match for the block and the parent block. It should only ensure that the current section is the current block of the variable (2nd value of the parents list - but we risk a collision if several blocks have the same name)
- when we have a component name on root level (or top level), the expandedVarMap and unexpandedVarMap are not filtered, so the val expandedValues = expandedVarMap.get(varName).getOrElse(Nil) takes all variables, everywhere, with same component name
thus we need to keep the path of the SectionSpec we are walking, and make sure that the "parents" of the component match the SectionSpec path
Updated by Nicolas CHARLES about 3 years ago
- Related to Bug #19990: Technique editor blocks do not report as expected added
Updated by Nicolas CHARLES about 3 years ago
Work in progess here: https://github.com/ncharles/rudder/commit/f130b792e60877fc8c19b955dbd832f1bbb50c76
Updated by François ARMAND about 3 years ago
- Subject changed from Duplicated reports leads to bad compliance for technique with blocks to Duplicated expected reports leads to bad compliance for technique with blocks
Updated by François ARMAND about 3 years ago
- Assignee changed from Nicolas CHARLES to François ARMAND
Updated by François ARMAND about 3 years ago
Work in progess here: https://github.com/fanf/rudder/commit/6f18f9401b1e43b4a5fa3cd6b633c6b8645db0c6
Updated by Nicolas CHARLES about 3 years ago
Work in progess here: https://github.com/ncharles/rudder/commit/652cdcc9c858fbf86f3032d81a37104338ae8aa0
Updated by Nicolas CHARLES about 3 years ago
Work in progess here: https://github.com/ncharles/rudder/commit/8ba439a52c570aed73f2d17fe1e3a7fdab042978
Updated by Nicolas CHARLES about 3 years ago
Work in progess here: https://github.com/ncharles/rudder/commit/48b0dcfd45e7e02e90442b04bda9b859e2d61d05
Updated by Nicolas CHARLES about 3 years ago
- Status changed from In progress to Pending technical review
- Pull Request set to https://github.com/Normation/rudder/pull/3948
Updated by Nicolas CHARLES about 3 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|be45be748d2ee31436391613e306953dff61fce3.
Updated by Vincent MEMBRÉ about 3 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 7.0.0~beta2 which was released today.
Updated by Nicolas CHARLES almost 3 years ago
- Related to Bug #20498: Compliance issue in 7.0 because of invalid expected reports added