Project

General

Profile

Actions

Bug #20124

closed

Duplicated expected reports leads to bad compliance for technique with blocks

Added by Nicolas CHARLES 7 months ago. Updated 7 months ago.

Status:
Released
Priority:
N/A
Category:
Web - Compliance & node report
Target version:
Severity:
User visibility:
Effort required:
Priority:
0

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


Related issues

Related to Rudder - Bug #19990: Technique editor blocks do not report as expectedReleasedFrançois ARMANDActions
Related to Rudder - Bug #20498: Compliance issue in 7.0 because of invalid expected reportsReleasedVincent MEMBRÉActions
Actions #1

Updated by Nicolas CHARLES 7 months ago

  • Subject changed from duplicated reports in UI with blocks in technique editor to duplicated reports with blocks in technique editor
  • Description updated (diff)
Actions #2

Updated by Nicolas CHARLES 7 months 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" 
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

Actions #3

Updated by Nicolas CHARLES 7 months 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"]}]}]}
Actions #4

Updated by François ARMAND 7 months 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)
Actions #5

Updated by Nicolas CHARLES 7 months ago

  • Status changed from New to In progress
  • Assignee set to Nicolas CHARLES
Actions #7

Updated by Nicolas CHARLES 7 months ago

several issue found:
  • 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

Actions #8

Updated by Nicolas CHARLES 7 months ago

  • Related to Bug #19990: Technique editor blocks do not report as expected added
Actions #10

Updated by François ARMAND 7 months 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
Actions #11

Updated by François ARMAND 7 months ago

  • Assignee changed from Nicolas CHARLES to François ARMAND
Actions #16

Updated by Nicolas CHARLES 7 months ago

  • Status changed from In progress to Pending technical review
  • Pull Request set to https://github.com/Normation/rudder/pull/3948
Actions #17

Updated by Nicolas CHARLES 7 months ago

  • Status changed from Pending technical review to Pending release
Actions #18

Updated by Vincent MEMBRÉ 7 months ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 7.0.0~beta2 which was released today.

Actions #19

Updated by Nicolas CHARLES 5 months ago

  • Related to Bug #20498: Compliance issue in 7.0 because of invalid expected reports added
Actions

Also available in: Atom PDF