Project

General

Profile

Actions

Bug #16232

closed

Bug #11917: No compliance from a Rule with only one Directive (from a technique created in the editor) when the Directive is also applied in another Rule

Directive based on a multivalued technique are not marked overriden

Added by François ARMAND about 5 years ago. Updated about 5 years ago.

Status:
Released
Priority:
N/A
Category:
Web - Compliance & node report
Target version:
Severity:
Minor - inconvenience | misleading | easy workaround
UX impact:
User visibility:
Getting started - demo | first install | Technique editor and level 1 Techniques
Effort required:
Very Small
Priority:
79
Name check:
To do
Fix check:
Error - Fixed
Regression:

Description

As explained in last comment of #11917, we broke something after the correction, and the correction disappeared. We should correct it back.


Subtasks 3 (0 open3 closed)

Bug #16280: Directives appears both skipped and enforceReleasedNicolas CHARLESActions
Bug #16293: Skipped directives are not displayed anymore - againRejectedFrançois ARMANDActions
Bug #16310: Directive skipped in several place appear duplicatedReleasedNicolas CHARLESActions
Actions #1

Updated by François ARMAND about 5 years ago

  • Status changed from New to In progress
Actions #2

Updated by François ARMAND about 5 years ago

Actually, it's more complexe than expected. If the rule has 0 reports (which is likely if it has only one directive which is overrided), then we don't reach the point where we look for overrides. And so we don't even get a chance to see them:

// the method called to display rule compliance
// class RuleCompliance (rule : Rule, rootRuleCategory: RuleCategory) { 
// ...
  def refreshCompliance() : JsCmd = {
    ( for {
        reports      <- reportingService.findDirectiveRuleStatusReportsByRule(rule.id)  
        allRules     <- roRuleRepository.getAll()
        groups       <- getGroups()
        updatedRule  <- Box(allRules.find(_.id == rule.id))
        directiveLib <- getFullDirectiveLib()
        allNodeInfos <- getAllNodeInfos()
        globalMode   <- configService.rudder_global_policy_mode()
      } yield {
        val directiveData = ComplianceData.getRuleByDirectivesComplianceDetails(reports, updatedRule, allNodeInfos, directiveLib, groups, allRules, globalMode).json.toJsCmd
...
// here "reports" is empty, so in getRuleByDirectivesComplianceDetails:

And:

  def getRuleByDirectivesComplianceDetails (
      report          : RuleStatusReport
    , rule            : Rule
    , ...
  ) : JsTableData[DirectiveComplianceLine] = {

    val overrides = getOverridenDirectiveDetails(report.overrides, directiveLib, allRules)
    // restrict mode calcul to node really targetted by that rule
    val appliedNodes = groupLib.getNodeIds(rule.targets, allNodeInfos)
    val nodeModes = appliedNodes.flatMap(id => allNodeInfos.get(id).map(_.policyMode))
    val lines = getDirectivesComplianceDetails(report.report.directives.values.toSet, directiveLib, globalMode, ComputePolicyMode.directiveModeOnRule(nodeModes, globalMode))

// here, overrides will be empty because there's node report.

So to correct that bug, we will need a significative change were we start by collecting expected reports containing that rule (either in expected or in override).
It may be good to do that in all cases, because it would rely on correct data, not received/calculated one based on received.
Or perhaps we could do that only when we are in the case with 0 reports.

Actions #3

Updated by François ARMAND about 5 years ago

  • Subject changed from Directive not written skipped even with 11917 correction to Directive based on a multivalued technique are not marked overriden

And it's totally not that.

The problem is actually that overrides are not correctly written for multivalued rules, so we don't get the "skipped" for directive based on "package" technique, but we will get it for directives based on "motd" technique. Updating title accordingly.

Actions #4

Updated by François ARMAND about 5 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/2625
Actions #5

Updated by François ARMAND about 5 years ago

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

Updated by Nicolas CHARLES about 5 years ago

  • Fix check changed from To do to Error - Next version
Actions #7

Updated by François ARMAND about 5 years ago

  • Fix check changed from Error - Next version to Error - Fixed
Actions #8

Updated by Vincent MEMBRÉ about 5 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 5.0.15 which was released today.

Actions

Also available in: Atom PDF