[augeas-devel] The save does nothing

David Lutterkort dlutter at redhat.com
Mon May 19 16:50:11 UTC 2008


On Mon, 2008-05-19 at 16:18 +0300, makkalot at gmail.com wrote:
> Hi again sorry for the delay , i hope we solve my problem :)
> > Cool .. out ofcuriosity, what will the tool do ?
> 
> You probably know it , it is func network automation tool (i'm a gsoc student) 
> and we want to be able to edit conf files of the remote machines easily so we 
> will write a wrapper that does all that stuff

Excellent .. I'd be very curious to see that; are you planning on
exposing the Augeas interface "straight up" through func or will you
wrap it in something more targetted ?

> [makkalot at localhost func-prepare]$ whoami
> makkalot
> [makkalot at localhost func-prepare]$ mkdir augeas-root
> [makkalot at localhost func-prepare]$ cp -R augeas-0.1.1/tests/root/etc/ 
> augeas-root/
> [makkalot at localhost func-prepare]$ export AUGEAS_ROOT=augeas-root

There's your problem: you set AUGEAS_ROOT to a relative path. Try
'export AUGEAS_ROOT=$PWD/augeas-root

> [makkalot at localhost func-prepare]$ echo $AUGEAS_ROOT
> augeas-root
> [makkalot at localhost func-prepare]$ cd augeas-root
> [makkalot at localhost augeas-root]$ ls
> etc
> [makkalot at localhost augeas-root]$ cd ..
> [makkalot at localhost func-prepare]$ chown -R $USER $AUGEAS_ROOT
> [makkalot at localhost func-prepare]$ cd augeas-root/
> [makkalot at localhost augeas-root]$ ls
> etc
> [makkalot at localhost augeas-root]$ augtool -b

This is where things go wrong: augtool now looks for files in the
current directory (augeas-root/) underneath AUGEAS_ROOT (also
augeas-root/) That doesn't exist, and therefore it finds no files.

> augtool> print
> /augeas
> /augeas/root = "augeas-root/"
> /augeas/save = "backup"
> /files
> /files/etc
> /files/etc/hosts
> /files/etc/hosts/10000
> /files/etc/hosts/10000/ipaddr = "192.168.0.1"
> /files/etc/hosts/10000/canonical = "pigiron.example.com"
> /files/etc/hosts/10000/alias[1] = "pigiron"
> /files/etc/hosts/10000/alias[2] = "piggy"
> augtool> exit

If augtool had found files, there'd be many more entries there. Also,
for every file F that augtool loads (where F is the absolute path of the
file, like '/etc/hosts') you'll get a few entries in /augeas/files/F; if
they don't exist, augtool didn't find that file, and therefore didn't
even try to read it.

David





More information about the augeas-devel mailing list