augeas - reading/modifying/writing system configuration files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

just want to introduce augeas to you developers.

_What is augeas?_

From: http://augeas.net/

Augeas is a configuration editing tool. It parses configuration files in their native formats and transforms them into a tree. Configuration changes are made by manipulating this tree and saving it back into native config files.

Augeas is:

    * An API provided by a C library
    * A command line tool to manipulate configuration from the shell (and shell scripts)
    * Language bindings to do the same from your favorite scripting language
    * Canonical tree representations of common configuration files
    * A domain-specific language to describe configuration file formats


_What can I do with augeas?_

Example: Set the default boot entry in grub

Shell:
# augtool
augtool> match /files/etc/grub.conf/title
/files/etc/grub.conf/title[1] = Fedora (2.6.25-14.fc9.x86_64)
/files/etc/grub.conf/title[2] = Linux 2.6.25-1
augtool> get /files/etc/grub.conf/default
/files/etc/grub.conf/default = 0
augtool> set /files/etc/grub.conf/default 1
augtool> save
augtool> quit
# grep default /etc/grub.conf
default=1

Python:
[root  ~]# python
Python 2.5.1 (r251:54863, Apr  8 2008, 01:19:33)
[GCC 4.3.0 20080404 (Red Hat 4.3.0-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import augeas
>>> a = augeas.augeas()
>>> a.match("/files/etc/grub.conf/title")
['/files/etc/grub.conf/title[1]', '/files/etc/grub.conf/title[2]']
>>> a.get("/files/etc/grub.conf/default")
'0'
>>> a.set("/files/etc/grub.conf/default", "1")
True
>>> a.save()
True
>>>
# grep default /etc/grub.conf
default=1


C:
augeas *a = aug_init(NULL, NULL, AUG_NONE);
ret = aug_match(a, "/files/etc/grub.conf/title", &matches_p);
ret = aug_get(a, "/files/etc/grub.conf/default", &value);
ret = aug_set(a, "/files/etc/grub.conf/default", "1");
ret = aug_save(a);

Simple, isn't it? :-)

See also: http://augeas.net/tour.html

_What should use augeas?_

All system-config-* tools should use augeas, as well as every tool modifying system configuration files like e.g. NetworkManager.

_Why should I switch my tool to use augeas?_

* not to reinvent the wheel
* one source to rule them all

_Where can I get augeas?_

augeas just passed the package review. https://bugzilla.redhat.com/show_bug.cgi?id=444792
python-augeas still needs someone doing the review. https://bugzilla.redhat.com/show_bug.cgi?id=444945

Meanwhile you can always download the source from: http://augeas.net/

--
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux