[augeas-devel] lens and query to append to a key:value pair in an INI file

Nathan Valentine nrvale0 at gmail.com
Fri Mar 4 18:57:56 UTC 2016


Hey, folks.

Not sure if I'm stuck on a problem with my custom lens, my understanding of
XPATH queries, or both (likely).

I'm trying to write a lens for the Datadog monitoring agent config file
which is an INI file using ':' as the separator. I took the Puppet.lens and
modified it ever so lightly. Here's a link for reference:

https://github.com/nrvale0/puppet-datadog-agent/blob/add_tag_define/lib/augeas/lenses/datadogagent.aug

And here's a snippet of a typical datadog.conf file:

https://gist.github.com/nrvale0/6fe12c3bcf7777340455

The motivation for writing the lens is I would like to be able to append
new tags to /files/etc/dd-agent/datadog.conf/Main/tags but I'm unsure as to
the best/correct way of:

1) creating 'tags' if not present
2) checking the tag string for the presence of my key:value pair
3) appending my key:value pair tag if not present

I'm also a little concerned that there will be a parse conflict with the
INI file format of using colon as a delimeter and the values of the 'tags'
entry having embedded colons but first things first..

Any advice would be greatly appreciated.

-- 
--- V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20160304/b12cbcba/attachment.htm>


More information about the augeas-devel mailing list