augeas is a command line generic tool to manage configuration text files. augeas comes with many “lenses”. The lenses are files that specify rules to read and write each kind of file. This is a very good to for scripting or automatic configuration management (like puppet does).

Here I want to read a simple properties file (compound by key=value lines) without define a specific “lens”. In particular, it is an Ice configuration file.

I need to write an augeas script (called ice-locator.augeas) like this:

#!/usr/bin/augtool -f

set /augeas/load/IniFile/lens simplevars.lns
set /augeas/load/IniFile/incl /etc/icegridnode.conf
get /files/etc/icegridnode.conf/Ice.Default.Locator

I using the a lens called “IniFile” and say to augeas that is good to read the file /etc/icegridnode.conf. That file looks like this:

Ice.Default.Locator=IceGrid/Locator -t:tcp -h -p 4061

Running the augeas script:

$ chmod +x ice-locator.augeas
$ ./ice-locator.augeas
/files/etc/icegridnode.conf/Ice.Default.Locator = IceGrid/Locator -t:tcp -h -p 4061


blog comments powered by Disqus