Bug #20828
closedArchitecture #20747: Use a unique id to identify reports
Unexpected/missing for same component, same value
Description
In the following case, we get 1 success, 1 missing, 1 unexpected because the expected reports are not correctly generated: we have 3 times 'vim' in place of two time htop and one time vim:
[2022-02-25 15:34:29+0000] TRACE explain_compliance.root - Expected reports for rule '32377fd7-02fd-43d0-aab7-28460a91347b': [expected] DirectiveExpectedReports(DirectiveId(DirectiveUid(2947648e-2521-473d-9274-07bd5c38a701),Revision(default)),None,false,List( ValueExpectedReport(Package present,List(ExpectedValueId(vim,dd3d7bf4-231d-4434-ad80-61367690f0da))), ValueExpectedReport(Package present,List(ExpectedValueId(vim,4a542919-f5a0-43b6-a756-fa8d96e758db))), ValueExpectedReport(Package present,List(ExpectedValueId(vim,26d74f7b-673a-4554-82ee-6e7bfb56433d))))) [2022-02-25 15:34:29+0000] TRACE explain_compliance.root - Reports for rule '32377fd7-02fd-43d0-aab7-28460a91347b': [report] ResultSuccessReport(2022-02-25T15:34:28.000Z,RuleId(RuleUid(32377fd7-02fd-43d0-aab7-28460a91347b),Revision(default)),DirectiveId(DirectiveUid(2947648e-2521-473d-9274-07bd5c38a701),Revision(default)),NodeId(root),dd3d7bf4-231d-4434-ad80-61367690f0da,Package present,htop,2022-02-25T15:34:25.000Z,Presence of package htop in any version was correct) [report] ResultSuccessReport(2022-02-25T15:34:28.000Z,RuleId(RuleUid(32377fd7-02fd-43d0-aab7-28460a91347b),Revision(default)),DirectiveId(DirectiveUid(2947648e-2521-473d-9274-07bd5c38a701),Revision(default)),NodeId(root),4a542919-f5a0-43b6-a756-fa8d96e758db,Package present,htop,2022-02-25T15:34:25.000Z,Presence of package htop in any version was correct) [report] ResultSuccessReport(2022-02-25T15:34:28.000Z,RuleId(RuleUid(32377fd7-02fd-43d0-aab7-28460a91347b),Revision(default)),DirectiveId(DirectiveUid(2947648e-2521-473d-9274-07bd5c38a701),Revision(default)),NodeId(root),26d74f7b-673a-4554-82ee-6e7bfb56433d,Package present,vim,2022-02-25T15:34:25.000Z,Presence of package vim in any version was correct) [2022-02-25 15:34:29+0000] TRACE explain_compliance.root - Compliance for rule '32377fd7-02fd-43d0-aab7-28460a91347b': [[root: 32377fd7-02fd-43d0-aab7-28460a91347b; run: 2022-02-25T15:34:25.000Z;20220225-153403-b10c0977->2022-02-25T15:44:25.000Z] compliance:[p:0 s:1 r:0 e:0 u:2 m:2 nr:0 na:0 rd:0 c:0 ana:0 nc:0 ae:0 bpm:0] [2947648e-2521-473d-9274-07bd5c38a701 => Package present:[htop(<-> htop):[Unexpected:"Presence of package htop in any version was correct"],vim(<-> vim):[Missing:"[Missing report #0]"]] Package present:[htop(<-> htop):[Unexpected:"Presence of package htop in any version was correct"],vim(<-> vim):[Missing:"[Missing report #0]"]] Package present:[vim(<-> vim):[Success:"Presence of package vim in any version was correct"]] ]]
It's OK if we use exactly same component name and values:
[2022-02-25 15:34:05+0000] TRACE explain_compliance.root - Expected reports for rule '32377fd7-02fd-43d0-aab7-28460a91347b': [expected] DirectiveExpectedReports(DirectiveId(DirectiveUid(2947648e-2521-473d-9274-07bd5c38a701),Revision(default)),None,false,List( ValueExpectedReport(htop,List(ExpectedValueId(htop,dd3d7bf4-231d-4434-ad80-61367690f0da))), ValueExpectedReport(htop,List(ExpectedValueId(htop,4a542919-f5a0-43b6-a756-fa8d96e758db))), ValueExpectedReport(vim,List(ExpectedValueId(vim,26d74f7b-673a-4554-82ee-6e7bfb56433d))))) [2022-02-25 15:34:05+0000] TRACE explain_compliance.root - Reports for rule '32377fd7-02fd-43d0-aab7-28460a91347b': [report] ResultSuccessReport(2022-02-25T15:30:58.000Z,RuleId(RuleUid(32377fd7-02fd-43d0-aab7-28460a91347b),Revision(default)),DirectiveId(DirectiveUid(2947648e-2521-473d-9274-07bd5c38a701),Revision(default)),NodeId(root),dd3d7bf4-231d-4434-ad80-61367690f0da,htop,htop,2022-02-25T15:30:55.000Z,Presence of package htop in any version was correct) [report] ResultSuccessReport(2022-02-25T15:30:58.000Z,RuleId(RuleUid(32377fd7-02fd-43d0-aab7-28460a91347b),Revision(default)),DirectiveId(DirectiveUid(2947648e-2521-473d-9274-07bd5c38a701),Revision(default)),NodeId(root),4a542919-f5a0-43b6-a756-fa8d96e758db,htop,htop,2022-02-25T15:30:55.000Z,Presence of package htop in any version was correct) [report] ResultSuccessReport(2022-02-25T15:30:58.000Z,RuleId(RuleUid(32377fd7-02fd-43d0-aab7-28460a91347b),Revision(default)),DirectiveId(DirectiveUid(2947648e-2521-473d-9274-07bd5c38a701),Revision(default)),NodeId(root),26d74f7b-673a-4554-82ee-6e7bfb56433d,vim,vim,2022-02-25T15:30:55.000Z,Presence of package vim in any version was correct) [2022-02-25 15:34:05+0000] TRACE explain_compliance.root - Compliance for rule '32377fd7-02fd-43d0-aab7-28460a91347b': [[root: 32377fd7-02fd-43d0-aab7-28460a91347b; run: 2022-02-25T15:30:55.000Z;20220225-153403-b10c0977->2022-02-25T15:40:55.000Z] compliance:[p:0 s:3 r:0 e:0 u:0 m:0 nr:0 na:0 rd:0 c:0 ana:0 nc:0 ae:0 bpm:0] [2947648e-2521-473d-9274-07bd5c38a701 => htop:[htop(<-> htop):[Success:"Presence of package htop in any version was correct"]] htop:[htop(<-> htop):[Success:"Presence of package htop in any version was correct"]] vim:[vim(<-> vim):[Success:"Presence of package vim in any version was correct"]] ]]
Files
Updated by François ARMAND almost 3 years ago
Confirmed that the problem is on the expected report side:
{ "ruleId":"32377fd7-02fd-43d0-aab7-28460a91347b", "directives":[ { "directiveId":"2947648e-2521-473d-9274-07bd5c38a701", "isSystem":false, "components":[ { "componentName":"Package present", "values":[ { "value":"vim", "id":"dd3d7bf4-231d-4434-ad80-61367690f0da" } ] }, { "componentName":"Package present", "values":[ { "value":"vim", "id":"4a542919-f5a0-43b6-a756-fa8d96e758db" } ] }, { "componentName":"Package present", "values":[ { "value":"vim", "id":"26d74f7b-673a-4554-82ee-6e7bfb56433d" } ] } ] } ] },
And technique.json
is ok, and technique.cf
is ok too (which was expected, since from the agent side, everything is fine).
Updated by François ARMAND almost 3 years ago
- Status changed from New to In progress
- Assignee set to François ARMAND
Updated by François ARMAND almost 3 years ago
ACTUALLY .
It is not correct, there is 3 VIM here, not just one.
It may have been between two generation on different tests. So it seems (for now) that:
- the expected reports are not correct,
- because in policy generation, RuleExpectedReportBuilder.componentsFromVariables can't build the correct components,
- because there is only one pvars,
- because Policy/policyDraft/etc are not correctly differentiating each var (report id is ignored, only component name is used)
Updated by François ARMAND almost 3 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from François ARMAND to Nicolas CHARLES
- Pull Request set to https://github.com/Normation/rudder/pull/4194
Updated by Félix DALLIDET almost 3 years ago
I had a similar issue on a 7.1-alpha1 on Debian11. I will attach the minimal technique I used to reproduce.
It just contains 2 almost identical method calls in a block, and it breaks the reporting.
Updated by François ARMAND almost 3 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|8cb0573436be3186d1b4cecc678892548966a2a8.
Updated by François ARMAND almost 3 years ago
- Related to Bug #20880: Removed report in compliance when calling several times the command_execution with same value added
Updated by Vincent MEMBRÉ almost 3 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 7.1.0~beta1 which was released today.