farsandra icon indicating copy to clipboard operation
farsandra copied to clipboard

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

Open jancona opened this issue 9 years ago • 1 comments

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.

jancona avatar Feb 18 '16 22:02 jancona

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.

edwardcapriolo avatar Feb 18 '16 23:02 edwardcapriolo