[augeas-devel] Some ideas about how to use Augeas with IPA

Dominique Dumont dominique.dumont at hp.com
Thu May 15 09:29:23 UTC 2008


David Lutterkort <dlutter at redhat.com> writes:

> On Wed, 2008-05-14 at 14:27 +0200, Dominique Dumont wrote:
>> >From a user's point of view, wouldn't it be better to get the error
>> message during the "set" command instead of the "save" command ?
>
> Unfortunately, that's not possible in general, since you might have to
> perform multiple "set" commands to get the tree into a syntactically
> correct state.
>
> As an example, an entry in /etc/hosts has to have, at a minumum, an
> ipaddr and a canonical name; after setting the ipaddr for a new entry,
> the tree is not syntactically correct. 

I faced the same problem with Config::Model and solved it by
introducing the notion of "mandatory" value. If a value is flagged as
"mandatory" in the model, you cannot save the file until the value is
set by the user.

> And because 'syntactically correct' can, in general, depend on
> things far away in the tree, it's also not easy to say what other
> properties need to hold after each "set".

With Config::Model, I use a "warping" mechanism where the structure or
property of a subset of the configuration tree depends on a
configuration value elsewhere (warp master).

For instance, with the Fstab model, changing fstype (e.g. ext2 ->
vfat) will remove the ext2 options from the UI and show the vfat
options.

Here's the example as shown by the TermUI interface with Fstab model
(Fstab model is provided as an example in Config::Model):

 >: fs:/home $ ll
name         value        type         comment
fs_spec      /dev/sda8    string       mandatory
fs_vfstype   ext2         enum         choice: auto davfs ext2 ext3 swap proc iso9660 vfat usbfs ignore, mandatory
fs_file      /home        string       mandatory
fs_mntopts   <Ext2FsOpt>  node
fs_freq      0            boolean
fs_passno    2            integer

 >: fs:/home $ cd fs_mntopts
 >: fs:/home fs_mntopts $ ls
async  atime  auto  dev  exec  group  mand  user  defaults  rw  acl  user_xattr  statfs_behavior  errors
 >: fs:/home fs_mntopts $ set - fs_vfstype=vfat
 >: fs:/home fs_mntopts $ ls
async  atime  auto  dev  exec  group  mand  user  defaults  rw
 >: fs:/home fs_mntopts $        

HTH

-- 
Dominique Dumont 
"Delivering successful solutions requires giving people what they
need, not what they want." Kurt Bittner




More information about the augeas-devel mailing list