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 #11876: Broken reporting in Rudder 4.3 with standart directives #1824

Conversation

fanf
Copy link
Member

@fanf fanf commented Jan 9, 2018

@fanf
Copy link
Member Author

fanf commented Jan 9, 2018

PR rebased

@fanf fanf force-pushed the bug_11876/broken_reporting_in_rudder_4_3_with_standart_directives branch from 0ac9b2d to b165a22 Compare January 9, 2018 17:22
Copy link
Member

@VinceMacBuche VinceMacBuche left a comment

Choose a reason for hiding this comment

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

Just a comment because I had 2 minutes to read, i need to look deeper tomorrow

@@ -235,7 +235,7 @@ object ExpectedReportsSerialisation {
~ ("components" -> (d.components.map { c =>
(
("componentName" -> c.componentName)
~ ("cardinality" -> c.cardinality)
// ~ ("cardinality" -> c.cardinality // #10625: ignore cardinality)
Copy link
Member

Choose a reason for hiding this comment

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

I think you should remove the line

Copy link
Member Author

@fanf fanf Jan 10, 2018

Choose a reason for hiding this comment

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

I'm going to remove it along with https://www.rudder-project.org/redmine/issues/11940 so that the "real" uniqueVariable cleaning is in the matching PR

Copy link
Member

Choose a reason for hiding this comment

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

OK then the pull request is ok to me :)

Copy link
Member

@ncharles ncharles left a comment

Choose a reason for hiding this comment

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

I don't see how the unique variable are managed now, as well as priority and ordering

, variables = expandedVars
, originalVariables = originalVars
)
val expandedVars = Policy.mergeVars(policyVars.map( _.expandedVars.values).toList.flatten)
Copy link
Member

Choose a reason for hiding this comment

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

there is a change of behaviour here: policy were ordered by priority, and if equal, alphanumerically
it had an impact on the order of variable, and usage of uniqueVariable.

this is replaced here by an unordered set, for both expandedVars and originalVars, which may result in different order for both, and it breaks completely the uniqueVariable usage - unless its done somewhere else, and I failed to see it (and in this case, we don't need to use lists)

Copy link
Member

Choose a reason for hiding this comment

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

my bad, after talking with @fanf , he explained me that policyVars are sorted, and the map().toList kept the order

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 is still sorted, but I will add comments to make it clearer.

} else {
val variable = mergedVars.get(newVar.spec.name) match {
case None =>
Variable.matchCopy(newVar, setMultivalued = true) //asIntance is ok here, I believe
Copy link
Member

Choose a reason for hiding this comment

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

this comment is not true anymore

@@ -925,12 +884,15 @@ object BuildNodeConfiguration extends Loggable {
// one more thing: we need to take care of unique variables.
Copy link
Member

Choose a reason for hiding this comment

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

i'm not sure it handles unique variable there

Copy link
Member

Choose a reason for hiding this comment

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

it does :)

, originalVars = mergeVars(sorted.flatMap(_.originalVars.values))
, trackerVariable= base.trackerVariable.spec.cloneSetMultivalued.toVariable(sorted.flatMap(_.trackerVariable.values))
)
val vars = sorted.map { d => PolicyVars(
Copy link
Member

Choose a reason for hiding this comment

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

the name vars has been confusing me seriously

@fanf
Copy link
Member Author

fanf commented Jan 10, 2018

PR rebased

@fanf fanf force-pushed the bug_11876/broken_reporting_in_rudder_4_3_with_standart_directives branch from b165a22 to ee7f2a7 Compare January 10, 2018 15:07
, expandedVars : Map[String, Variable]
, originalVars : Map[String, Variable] // variable with non-expanded ${node.prop etc} values
, trackerVariable : TrackerVariable
, policyVars : NonEmptyList[PolicyVars]
Copy link
Member

Choose a reason for hiding this comment

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

<3


// now the first draft is the mode prioritary. We keep it as "main" draft
// now the first draft is the most prioritary. We keep it as "main" draft
Copy link
Member

Choose a reason for hiding this comment

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

Now the first draft has priority

Copy link
Member

@VinceMacBuche VinceMacBuche left a comment

Choose a reason for hiding this comment

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

Looks good to me, apart the commented lines to remove !
The end of cardinality \o/

Copy link
Member

@VinceMacBuche VinceMacBuche left a comment

Choose a reason for hiding this comment

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

I'm VinceMacBuche, and i approve this Pull request

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/1824
-- Your faithful QA

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/1824
-- Your faithful QA

@fanf
Copy link
Member Author

fanf commented Jan 10, 2018

OK, merging this PR

@fanf fanf merged commit ee7f2a7 into Normation:master Jan 10, 2018
@fanf
Copy link
Member Author

fanf commented Jan 10, 2018

OK, merging this PR

@fanf fanf deleted the bug_11876/broken_reporting_in_rudder_4_3_with_standart_directives branch March 15, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants