Just to be clear: I am offering to write what I describe below if it seems acceptable to others (and if I get the time).
I love the idea of Augeas, and I love that Puppet has built-in support for it. However, I'm finding that I'm routinely unable to do things with the Puppet Augeas type that I could trivially do with augtool and /bin/sh. So, here's some examples and how I think they could be fixed. Example 1 --------- Let's pretend that there was no alias type in Puppet (just because it's a file everyone's familiar with). Let's say that I wanted to set the postmaster alias to f...@bar.com using Augeas. The problem is, I have no idea what the Augeas path for postmaster is. The shell solution is something like: path=$(augtool match /files/etc/aliases/\*/name postmaster | sed 's;/[^/]*$;;') augtool set $path/value f...@bar.com I can't see any way to do anything like this in the Augeas type we have now, so I propose the following extensions, which would conflict with the "changes" argument. This would limit things to one change per Augeas type entry as far as I can tell, but oh well. command => set path => STRING value => STRING command => insert/ins where => before/after path => STRING value => STRING command => mv path => STRING destination => STRING command => rm/remove/delete path => STRING command => clear path => STRING Nothing terribly exciting there; the new bit is that instead of "path" you can use one of these: match_path => STRING match_type => int/integer/size match_args => [ COMPARATOR, INT ] match_path => STRING match_type => regex/not_regex match_args => [ STRING ] match_path => STRING match_type => in/not_in match_args => [ STRING, STRING, ... ] The "size" and "in" types are basically identical to the current onlyif stuff. regex looks for a path that matches the given regex. not_in and not_regex match if the string isn't found or doesn't match the regex, respectively. In addition, they all take: match_post_regex => [ STRING, STRING ] which takes the matched path and essentially does path.sub!( regex[0], regex[1] ). The point being to do what the sed in the shell example above does. The result of all the match_path stuff is treated as the path value for the set, insert, or mv. Example 2 --------- Again, working with the aliases file. I want to add an alias from "foo" to "b...@baz.com", but obviously I only want to add it once. onlyif won't work, but I really don't like the syntax of onlyif anyways: it's not Puppet-like, and it doesn't actually match how augtool works either. So, I propose this, based on the above: onlyif_match_path => STRING onlyif_match_type => int/integer/size onlyif_match_args => [ COMPARATOR, INT ] onlyif_match_path => STRING onlyif_match_type => regex/not_regex onlyif_match_args => [ STRING ] onlyif_match_path => STRING onlyif_match_type => in/not_in onlyif_match_args => [ STRING, STRING, ... ] This does everything the current onlyif does, and quite a bit more besides. There is no equivalent to match_post_regex, because the onlyif_match_* isn't actually used to do anything, the way match_* is. -Robin -- They say: "The first AIs will be built by the military as weapons." And I'm thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---