[augeas-devel] Associating lenses with files in other locations

Jo Rhett jrhett at netconsonance.com
Wed Sep 21 19:46:15 UTC 2011


I'm using augeas 0.9.0 on CentOS 5.6. Printing and making changes to files in their normal locations works just fine.

I have a need to test/evaluate the editing of files in non-standard locations.  From reading the documentation and various online sources I've found several ways that should work, but none of which work as I (mis)understood them. Please clue me over the head, please ;-)

First was to create a fake root:

$ mkdir -p augroot/etc
$ cp /etc/fstab /etc/my.cnf /etc/hosts augroot/etc/
$ augtool --root=aigret
augtool> print /files/etc/stab
augtool> print /files/etc/hosts
augtool> print /files/etc/my.cnf
augtool>

The above shows no response == unparsed file. This doesn't appear to work.  The modules are available in /augeas/load but no files of any type that I put here are parsed.

The second was to attempt to apply a specific filter to a file.  According to the docs this should work:

$ augtool
augtool> set /augeas/load/MySQL/incl[4] /home/jrhett/augroot/etc/my.cnf
augtool> ls /augeas/load/MySQL
lens = @MySQL
incl[1] = /etc/my.cnf
incl[2] = /etc/mysql/conf.d/*.cnf
incl[3] = /etc/mysql/my.cnf
excl[1] = *.augnew
excl[2] = *.augsave
excl[3] = *.dpkg-dist
excl[4] = *.dpkg-bak
excl[5] = *.dpkg-new
excl[6] = *.dpkg-old
excl[7] = *.rpmsave
excl[8] = *.rpmnew
excl[9] = *~
incl[4] = /home/jrhett/augroot/etc/my.cnf
augtool> load
augtool> print /files/home/jrhett/augroot/etc/my.cnf
augtool>

So I tried delaying load as documented on this page http://www.raphink.info/2011/02/manually-associating-lenses-with-files.html

$ augtool --noload
augtool> set /augeas/load/MySQL/lens MySQL.lns
augtool> set /augeas/load/MySQL/include /home/jrhett/augroot/etc/my.cnf
augtool> load
augtool> print /files/home/jrhett/augroot/etc/my.cnf
augtool>

This didn't work either.

-- 
Jo Rhett
Net Consonance : consonant endings by net philanthropy, open source and other randomness

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110921/99d3b39a/attachment.htm>


More information about the augeas-devel mailing list