[augeas-devel] puppet and Augeas
David Lutterkort
lutter at redhat.com
Thu Jun 2 08:53:40 UTC 2011
On Wed, 2011-06-01 at 16:36 -0400, Glenn Buckholz wrote:
> All,
>
> I've RTFMed as best I can but I am missing something. Is there a way in
> puppet to have Augeas set a variable value or create a list of values based
> on a match? Currently I'm writing my own puppet type to do something like
> this but there are limitations.
>
> What I'm looking for is something like:
>
> augeas {
> "set some var":
>
> val=> "match /files/etc/my.cnf/target[ . =
> \"mysqld\"]/allow-suspicious-udfs size > 0",
> var=> $myvar
> }
>
> where $myvar would maintain that value in its scope.
>
> Does this exist and I'm just looking in the wrong place?
No, as far as I know, that does not exist. The right way to do this with
puppet wouldn't be as part of the augeas type, but as a custom function,
so that you could write
$myvar =
augget("/files/etc/hosts/*[ipaddr='127.0.0.1']/canonical")
or
$stuff = augmatch("/files/etc/hosts/*/canonical")
There's two functions for querying the tree in the Augeas API: aug_get
to get the value of exactly one node, and aug_match to find all nodes
matching some path expression. The former maps nicely to puppet: it just
returns a string. The latter is a little trickier, since it inherently
returns a list of paths (strings)
I haven't been following puppet closely enough to know what the best
data structure for a list of strings is. Puppet devs will know ;)
David
More information about the augeas-devel
mailing list