On Mon, 2010-05-10 at 12:36 -0700, Russell Jackson wrote:
> On 05/03/2010 04:38 PM, David Lutterkort wrote:
> > On Sat, 2010-05-01 at 22:07 -0700, Russell Jackson wrote:
> >> I've modified the freebsd service provider to use augeas (which I've also 
> >> written ports 
> >> for as well as the ruby bindings) to edit /etc/rc.conf (wrote a lens for 
> >> it and is 
> >> distributed with the port)
> > 
> > Completely unrelated, but I'd love to get a copy of the lens for
> > upstream augeas. It would be great if you could either send it to the
> > augeas mailing list, or, for simplicity to me privately.
> > 
> 
> I'm having a bit of a dilemma on this actually. The shellvars lens works
> out of the box after adding /etc/rc.conf to the transformation filter;
> the problem is that, in rc.conf, all values are quoted. So, the parsed
> tree is mess with entries like:
>       
>       /files/etc/rc.conf/foo "\"bar\""
> 
> I've been been unable to modify the stock shellvar lens so that quotes
> are optional while also discarding quotes from the tree without getting
> ambiguous grammer errors. I've attached the lens I have currently.

For general shellvars files, that's not possible, since the quotes
actually carry meaning ('$FOO' is different from "$FOO" in these files);
when you strip quotes, Augeas has no idea what quotes to use for new
entries in the general case.

> On the other hand, even though rc.conf is a sh script, it is supposed to
> only have simple variable declarations with quoted values as defined by
> rc.conf(5). So maybe, it is better to have a simplified lens that
> doesn't permit illegal shell constructs to be present.

Yes, if it is guaranteed that all entries in rc.conf are enclosed in
double quotes, you could make the lens strip the quotes. It would also
be much simpler than the shellvars lens since it doesn't have to handle
crazy stuff like shell arrays.

David



-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to