Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #8344: Missing relevant information about why the compliance is what it is on node #1103

Conversation

fanf
Copy link
Member

@fanf fanf commented May 24, 2016

@fanf
Copy link
Member Author

fanf commented May 24, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 6f28748 to 85addd4 Compare May 24, 2016 14:42
@@ -149,6 +160,7 @@ class ReportsExecutionService (
reportsRepository.getReportsWithLowestId match {
case Full(Some((id, report))) =>
logger.debug(s"Initializing the status execution update to id ${id}, date ${report.executionTimestamp}")
this.idForCheck = id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why a this here ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the idForCheck ? For init, else it remains at 0 (it would change on next run, but I don't think it's a problem ?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, question is why a "this." only here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, because the param is also named "id", and if I don't qualify the other id, there is a name conflict

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would understand if the 'this.' was on 'id', but I don't understand why you need to add it to IdForCheck

idForCheck = id

Would have been what I expect!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't understand you explaination @fanf :( I don't see the conflict

@VinceMacBuche
Copy link
Member

Why is there still two commits, 94e73d3 should be removed as it was merged elsewhere

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 85addd4 to de7c2cb Compare May 24, 2016 14:58
@fanf
Copy link
Member Author

fanf commented May 24, 2016

PR rebased

@@ -95,17 +96,17 @@ trait RuleOrNodeReportingServiceImpl extends ReportingService {
nodeIds <- confExpectedRepo.findCurrentNodeIds(ruleId)
reports <- findRuleNodeStatusReports(nodeIds, Set(ruleId))
} yield {
RuleStatusReport(ruleId, reports.toIterable)
val toKeep = reports.values.flatMap( _._2.filter( _.ruleId == ruleId))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you refiltering ? findRuleNodeStatusReports is already filtering by ruleId

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No good reason, I guess

@fanf
Copy link
Member Author

fanf commented May 24, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from de7c2cb to 070eeea Compare May 24, 2016 15:11
report = reports.groupBy(_.nodeId).map { case(nodeId, reports) => NodeStatusReport(nodeId, reports) }.toSet
result <- if(report.size == 1) Full(report.head) else Failure("Found bad number of reports for node " + nodeId)
reports <- findRuleNodeStatusReports(Set(nodeId), Set())
(run, set) <- reports.get(nodeId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail is there are no reports on the given node -with a nasty stacktrace)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkAndUpdateCache can return an empty map

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it's an option with get, but you're right, it should be better with an error message

@VinceMacBuche
Copy link
Member

If I undestand changes on ReportingService correctly, you change how Rule reports are sent from a 'Set of the reports on the Rule' to 'A Map that associate For a Node(id) to a couple RunAndConfig ( run and configuration id state) and the set of reports applied to that node ?

@fanf
Copy link
Member Author

fanf commented May 24, 2016

Yes

case Some(c) => s"configId:${c.value}"
}
s"${r.ruleId.value}/${r.serial}[exp:${r.expirationDate}][${run}][${cfid}]${r.compliance.toString}"
s"${r.ruleId.value}/${r.serial}[exp:${r.expirationDate}]${r.compliance.toString}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why aren't you serializing agent run time anymore ? (config_id is toLog)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just below, because it's common to all reports for that run

@fanf
Copy link
Member Author

fanf commented May 24, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 070eeea to c7fd6e2 Compare May 24, 2016 15:20
(
<p>{currentConfigId(expectedConfigId)}</p>
<p>But we received a run, started at {lastRunDateTime.toString(dateFormat)}, with a different configuration ID ({lastRunConfigId.configId.value})</p>
<p>The time since generation of the new configuration is greater than the grace period, so every received reports will be mark as unexpected</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be marked

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/every/all/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/greater/longer/

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from c7fd6e2 to 119f4da Compare May 24, 2016 16:28
@fanf
Copy link
Member Author

fanf commented May 24, 2016

PR rebased

1 similar comment
@fanf
Copy link
Member Author

fanf commented May 24, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 119f4da to 8a28641 Compare May 24, 2016 16:35
report = reports.groupBy(_.nodeId).map { case(nodeId, reports) => NodeStatusReport(nodeId, reports) }.toSet
result <- if(report.size == 1) Full(report.head) else Failure("Found bad number of reports for node " + nodeId)
reports <- findRuleNodeStatusReports(Set(nodeId), Set())
(run, set) <- Box(reports.get(nodeId)) ?~! s"Can not find report for node with ID ${nodeId.value}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much awesomeness (was reallly complicated before ...)

@VinceMacBuche
Copy link
Member

It seems ok to me ! (but i can't say my brain can compute all cases)

If @ncharles as nothing more to say, it's ok to merge !!

s" last run: nodeConfigId: ${lastRunConfigId.toLog} received at ${lastRunDateTime} |"+
s" expire at ${lastRunExpiration}]"
s" expire at ${lastRunExpiration}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/expire/expired/

case NoReportInInterval(expectedConfigId) =>
(
<p>{currentConfigId(expectedConfigId)}</p>
<p>No recent runs were received for that node, and the grace period to get them expired.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/that node/node/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/get them/receive them/

@fanf
Copy link
Member Author

fanf commented May 25, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 8a28641 to 7d8b216 Compare May 25, 2016 07:39
@fanf
Copy link
Member Author

fanf commented May 25, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 7d8b216 to 7ecb070 Compare May 25, 2016 07:40
@fanf
Copy link
Member Author

fanf commented May 25, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 7ecb070 to 963ecc0 Compare May 25, 2016 07:43
@fanf
Copy link
Member Author

fanf commented May 25, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 963ecc0 to bb17a07 Compare May 25, 2016 07:51
@ncharles
Copy link
Member

except for my question, this looks ok
Caution, you'll probably need to change on 3.2 to handle the disabled reporting case

@fanf
Copy link
Member Author

fanf commented May 25, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from bb17a07 to 159bfc8 Compare May 25, 2016 09:12
@fanf
Copy link
Member Author

fanf commented May 25, 2016

PR rebased

@fanf fanf force-pushed the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch from 159bfc8 to 08add9f Compare May 25, 2016 09:41
@ncharles
Copy link
Member

looks ok to me with the explaination

@ncharles ncharles merged commit e216788 into Normation:branches/rudder/3.0 May 25, 2016
@fanf fanf deleted the bug_8344/missing_relevant_information_about_why_the_compliance_is_what_it_is_on_node branch March 15, 2024 10:52
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants