On Thu, Jan 15, 2009 at 04:27:20PM -0500, Bryan Kearney wrote:
> 
> windowsrefund wrote:
> >  augeas { "$name":
> >                 context => "/files",
> >                 changes => "set /etc/exports/foo bar",
> >                 require => File["/etc/exports"],
> >  }
> > 
> > 
> 
> Augeas will validate the structure of what you are setting. Look
> in /usr/share/augeas/lenses/exports.lns for a description of the
> regular expression voodoo. My guess is that you are not setting a
> valid structure.

Yes, you have to actually set something that matches the structure
of the file in question, which varies by file.  Most of the lenses
have shit for documentation, unfortunately, and this one is no
exception.

So, the easiest thing to do is to set up the file with some
examples (I pulled examples from the bottom of "man 5 exports") and
see what they look like:

    $ augtool
    augtool> ls /files/etc/exports/
    comment[1] = /etc/exports: the access control list for filesystems which 
may be exported
    comment[2] = to NFS clients.  See exports(5).
    comment[3] = sample /etc/exports file
    dir[1]/ = /
    dir[2]/ = /projects
    dir[3]/ = /usr
    dir[4]/ = /home/joe

It took several tries to get this; it turns out the augeas lens for
this file is a bit pickier than it should be: it won't accept:

    /pub            (ro,insecure,all_squash)

Anyways, from here you can investigate the structure, like so:

    augtool> ls /files/etc/exports/dir[1]
    client[1]/ = master
    client[2]/ = trusty

The corresponding line in the file is:

    /               master(rw) trusty(rw,no_root_squash)

Digging further:

    augtool> ls /files/etc/exports/dir[1]/client[1]
    option = rw

So, if you want to add a new entry, you'd do something like this:

    augtool> set /files/etc/exports/dir[10000] /foo
    augtool> set /files/etc/exports/dir[last()]/client[1] weeble
    augtool> set /files/etc/exports/dir[last()]/client[1]/option[1] ro
    augtool> set /files/etc/exports/dir[last()]/client[1]/option[2] all_squash
    augtool> save
    Saved 1 file(s)

Which creates the line:

    /foo weeble(ro,all_squash)

Doing this in Puppet is left as an exercise for the reader.  I'll
go see about getting better docs in Augeas for this thing.

-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
-~----------~----~----~----~------~----~------~--~---

Reply via email to