Provide new oslo.config option which would handle JSON/YAML option based upon StrOpt

Registered by Denis M. on 2013-10-23

Trove(DBaaS) wants to use dict-in-dict option and do not perform any of parsing manipulations.

Point is to have DictInDict option.
config file format:
                          param_name = key0: {key1: value, }, key2:{key3: value, },
parsed format:
                     CONF.param_name = {key0, : {key1: value, }, key2:{key3: value, }}

Blueprint information

Status:
Started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Discussion
Series goal:
None
Implementation:
Slow progress
Milestone target:
None
Started by
Denis M. on 2013-10-23

Related branches

Sprints

Whiteboard

What would the values actually be? This feels like a much more complex set of configuration values than we normally manage with oslo.config. -- dhellmann

Value could be nested primitive (int, string), list, dictionary.
For now oslo can't parse into DictOpt only primitive:primitive.
My point is to extend DictOpt, or make another option which would represent one of nesting. Personaly i'm interested in primitive:list and primitive: {primitive: list}
Config format would be rather complex, but it's implementable. -- dmakogon

Yeah, I was less concerned with humans having to edit the file format than I was with writing a parser. :-) Why not use something that supports proper nested data structures, like YAML or even JSON? -- dhellmann

Good idea about YAML and JSON, their implementation could use MultistringOpt as base. And then it could be parsed by json or yaml python packages into dictionaties. -- dmakogon

MultiStrOpt is used for multy entry config value with the same key, so looks StrOpt matches the best. Concerning data formating, the cfg.py also used for cli arguments processing, and the \n can make troubles or should be escaped. -- isviridov

Actually, I meant we should just have an option specifying a separate file, and that file could be in another format. There is no need to add YAML support to oslo.config. - dhellmann

But we need more complex parameter than DictOpt with primitives as key and value.
I suppose we need to add json option and do not parse any of string in every project that need is. -- dmakogon

What exactly is this complex data, and why does it need to be in the main config file rather than a separate file? - dhellmann

In Trove we need to specify next parameter: primitive: {primitive: primitive/list/dict} and oslo should have support more complex parameters specified in main config, i should not be a another one config file.
-- dmakogon

I understand that you need complex nested data structures. What is in them? What do the configuration options describe? - dhellmann

security network access: ports upot tcp and udp protocols

OK, I *still* think this is a bad idea, and that more complex data like that should just be read from a separate configuration file. Before scheduling the blueprint, let's have a discussion about it with more detail on the mailing list so I can understand why the values need to be in the main configuration file. -- dhellmann

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.