[augeas-devel] Feature request: apply a given lense to a given file.

David Lutterkort lutter at redhat.com
Mon Jan 19 18:56:18 UTC 2009


On Sun, 2009-01-18 at 17:09 -0800, Robin Lee Powell wrote:
> So, as an example, the php.aug lens (aka inifile.aug, basically)
> seems to work Just Fine on /etc/samhain/samhainrc; I can imagine
> some improvements, but it's probably good enough.

As a bandaid, you could just put a file into your lens directory like

        module Samhain
          autoload xfm
          let xfm = transform Php.lns (incl "/etc/samhain/samhainrc")

> It would be nice if I could tell augtool/the API (well, puppet
> really, but that'd come later) something to the effect of "apply
> this lense here to that file there; don't bother parsing anything
> else".  Saves the trouble of producing another essentially identical
> lense.

If it's good enough for general use, it should become an official lens.

But I completely agree there is a need to control file parsing at
runtime, without putting anything into the lens dir. I imagine we'd do
that by manipulating a special place underneath /augeas, say something
like

        > augtool --noautoload
        augtool> rm /augeas/transform/*
        augtool> set /augeas/transform/samhain/lens Php.lns
        augtool>
        set /augeas/transform/samhain/incl /etc/samhain/samhainrc
        augtool> load
        
where the name after /augeas/transform (the 'samhain' above), doesn't
really matter.

To make that happen, I'd need to

      * expose the transforms read from .aug files in /augeas/transform
      * add a 'load' command that throws away the exsting /files tree
        and parses files according to what's in /augeas/transform
      * add a '--noautoload' flag to augtool

Would that address your needs ?

David





More information about the augeas-devel mailing list