On 06/13/2014 10:05 AM, Jan Pazdziora wrote:
On Fri, Jun 06, 2014 at 11:34:02AM -0400, Dmitri Pal wrote:
> Last time I looked at Augeas (which was some time ago) it did not:
> - allow multiple key instances like this
> key = val1
> key = val2
It does now -- for single record, I get
/files/etc/sssd/sssd.conf/target[1]/dns_discovery_domain = "domain.com"
for two records I get
/files/etc/sssd/sssd.conf/target[1]/dns_discovery_domain[1] = "domain.com"
/files/etc/sssd/sssd.conf/target[1]/dns_discovery_domain[2] = "xdomain.com"
> and ability to iterate a section and access them.
Could you elaborate?
Get first, get next type of fetching of values for the same key in a
section.
> - allow processing the config and handling the sections in different
> ways detecting collisions, erroring on them or merging them on the fly
> as one requests
I'd say this should not be part of any low level library. Knowledge
of semantics is required for that so if this is needed, it should be
a separate tool on top of either low level code.
It can be pretty generic if you do not merge values.
> - merging two configs the way you want
This might be true but the question is, how often is this needed? You
typically have some existing sssd.conf state and you want to do some
modifications to it based on software you plan to enable or add to the
configuration. I'd guess you usually do not have seconf completely
working configuration, wanting to merge the two. If you have
conflicting values for single-valued key, generic tool will not help
to resolve the conflict.
This is your use case. It is valid but it is different from the one the
merge was built for.
The use case the merge is needed is when there is a file that is coming
from puppet and the file that admin set locally to augment or overwrite
the configuration.
A different case is when an application needs to drop in a section into
your config like with include files.
> - support of BOMs - encodings at the beginning of the file
> - adding and or modifying comments
Using set #comment should work.
> - allowing to wrap values
> - processing lists of values in a convenient way
True.
--
Thank you,
Dmitri Pal
Sr. Engineering Manager IdM portfolio
Red Hat, Inc.