[augeas-devel] example for inline includes

David Lutterkort dlutter at redhat.com
Wed Jun 25 17:24:13 UTC 2008


On Wed, 2008-06-25 at 18:35 +0200, Joshua Sierles wrote:
> Is there a way to handle inline include directives in Augeas? For  
> example, an include directive in Apache or Nginx configs where context  
> is important. Looking at some example and talking to someone on IRC  
> seemed to suggest this would be hard to do with Augeas.

There's two ways in which this could be done:

     1. Add a call to the Augeas API that says 'use this lens to process
        this file' which would require that the user of the API knows
        which entries in the tree correspond to include directives
     2. Add a facility to Augeas' DSL to indicate the same. With that,
        knowledge about includes would be built into the file format
        descriptions, and users of the API wouldn't need to know that.

Option (1) would be pretty easy to implement, I am thinking of an API
call like

        int aug_transform(augeas *aug, const char *lens, 
                          int nincl, const char *incl[], 
                          int nexcl, const char *excl[])

where LENS is the name of a lens (e.g., "Yum.lns") and INCL and EXCL are
arrays of globs. Essentially, this would let you construct a transform
through the API, in a way very similar to what you do with the
'transform' builtin in the DSL.

Option (2) is a little hairier, mostly because I am not sure how to
handle scenarios where one of the included files has been modified, and
then the 'include' entry in the main file is changed ... should we still
write out the now no-longer-used included file ? Besides these
conceptual problems, it would also be more difficult to implement.

David





More information about the augeas-devel mailing list