[augeas-devel] Lens compatibility (ticket #295)
David Lutterkort
lutter at redhat.com
Fri Sep 7 18:00:15 UTC 2012
On Mon, 2012-08-27 at 21:30 +0100, Dominic Cleal wrote:
> It's this config mechanism that I'm uncomfortable with. It seems to me
> that we need something in the API that applications would use to
> indicate their expected configuration rather than config through files.
>
> Using files sounds like more work for a sysadmin and not as easy for an
> application dev to make use of, as they'd have to set up a directory,
> config file, change the include dirs etc.
Yes, this is an important point, it has a few implications though:
* there needs to be a way to send some sort of variables/values
from the API to the lens language, something that is not
possible today
* because of that, we have one of three options for conditionals
1. evaluate conditionals very late, e.g. only when a lens
containing a conditional is used (complete nightmare)
2. reload all lenses when one of these values gets changed
3. expose an API call to trigger reloading of all modules
We could do something like the following, using option 3 above:
* Change interpreter_init to do the following early on:
* search for and load a config.aug before it loads any
other modules
* Add any values set through the API via aug_config (see
below) into the Config module
* load other modules as it does now
* Add an API call 'api_config(augeas *, const char *name, const
char *value)' to set overrides for the Config module; calling
aug_config(aug, "setting", "value") would have the same effect
as writing 'let setting = "value"' in config.aug
* Add an API call 'api_reinit(augeas *)' which would rerun
interpreter_init and invalidate the /files tree; the user needs
to call aug_load to populate it (again)
With that, you could use a 'match Config.foo with ..' construct in other
modules. We'd have to require that any use of a Config.foo in a lens is
accompanied by adding an entry to the stock config.aug that sets it to a
default value, and documents what it's for, and what values it can take.
David
More information about the augeas-devel
mailing list