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

Arc 4778/4782 split interpolation variable parsing and binding #507

Conversation

fanf
Copy link
Member

@fanf fanf commented May 2, 2014

Massive refactoring to split parsing of interpolation variable in directive parameters from there expansion when we build node configuration.

Completly change the way we look for interpolation variables from plain regex with a "while something change, try to apply a regex replace" logic, to a real parser + interpretation.

Also, clean up the data structures used:

  • in the promise generation script, we only:
    • read ruleVal at the begining: ruleVals are image of what the user configured, with interpolation
    • build nodeConfiguration that are what is used to generate node configuration (and so, promises)
  • expandedRuleVal are only used in reporting code
  • along the way, we used an internal, private data structure (policydraft)

@@ -203,6 +202,7 @@ class SystemVariableServiceImpl(

val varManagedNodes = systemVariableSpecService.get("MANAGED_NODES_NAME").toVariable(children.map(_.hostname))
val varManagedNodesId = systemVariableSpecService.get("MANAGED_NODES_ID").toVariable(children.map(_.id.value))
//IT IS VERY IMPORTANT TO SORT SYSTEM VARIABLE HERE: see ticket #4859
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't it have been in the other commit ?

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 the comment that was missing (bad rebase, I think)

@ncharles
Copy link
Member

Appart from comments related remarks, this looks good to me
this is a most welcomed improvement, thank you Francois

Massive speed gain (x10) and massive code simplification
@fanf
Copy link
Member Author

fanf commented May 18, 2014

PR updated & rebased on last master

@ncharles
Copy link
Member

awesome, thank you !

ncharles added a commit that referenced this pull request May 19, 2014
…ariable_parsing_and_binding

Arc 4778/4782 split interpolation variable parsing and binding
@ncharles ncharles merged commit f7a780f into Normation:master May 19, 2014
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.

2 participants