[augeas-devel] RFC: Augeas Check function

David Lutterkort lutter at redhat.com
Fri Jan 9 19:03:11 UTC 2009


On Fri, 2009-01-09 at 13:34 -0500, Bryan Kearney wrote:
> For the puppet plugin, I would like to know if a change will be made 
> before making it. Basically, to understand how many files would be 
> effected by an aug_save call.
> 
> Can you please look at the latest commit here:
> 
> http://github.com/bkearney/augeas/tree/master
> 
> I added an aug_check method to perform this. I opted to replicate the 
> aug_save and tree_save methods instead of having alot of 
> if_actually_saving logic in the tree_save method. I did some simple 
> tests and it seems to work. It may be a odd edge case, but it would make 
>   the puppet plugin alot easier :)

This kinda overlaps with another change I've been meaning to make: make
it possible to change how things are saved at runtime - right now, you
need to decide that when you call aug_init by passing one of the
AUG_SAVE_* flags. 

I've been meaning to change that so that you can do something like
  set /augeas/save overwrite
  save
  .. more changes to the tree ..
  set /augeas/save backup
  save
so that the first batch of changes just overwrites existing files, and
the second also saves .augsave files.

With that model, we'd add another option for /augeas/save, say 'check'
or 'none' and do what your aug_check call does. With that, we wouldn't
need to add another API call, and the implementation would just be a few
additional lines in aug_save and tree_save.

What do you think about approaching it that way ?

David





More information about the augeas-devel mailing list