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

Handle YAML replacement using SnakeYAML parsing/serialization instead of string manipulation. #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jancona
Copy link
Contributor

@jancona jancona commented Feb 18, 2016

Handle YAML replacement using SnakeYAML parsing/serialization instead of string manipulation.

So I was thinking about the discussion on #22. I wondered if the issues around supporting multiple versions could be reduced by parsing the YAML and manipulating the parsed tree, rather than doing text replacement. This is the result.

I used SnakeYAML to parse cassandra.yaml and built a little object model (see here). It's backed by the generic SnakeYAML parse tree, with custom getters and setters for the values we want to change.

The only existing API I couldn't support was withYamlReplacement. I could do something like withYamlReplacement(String name, Object Value) but it wouldn't be compatible with the existing API.

@edwardcapriolo
Copy link
Owner

Hum this gets a little bit tricky. One of the things about FAR sandra is we do not want "intimate" knowledge of the structure of the configs because they are subject to change. I think in the end we have to be version specific, because one model probably would not work for 1.2 -> 3.0. Let me look this over some more.

In the end I do not think there is a way for a tool to understand config files (think like puppet/cfengine) most of the work is approximations based on a known base state. But let me look this over and chew this over a bit.

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