Elektra
0.8.19
|
Some plugins are generic in the sense that they cannot fully define their contract statically. (Note: if they can decide it statically, you should prefer compilation variants.) Instead their contract is based on their configuration. We will call every combination of plugins+configuration where we get a different contract plugin variant.
The current issue is that there is no way to enumerate possible plugin variants as needed to list all functionality of Elektra.
A specification of the plugin's configuration and a tool that can enumerate all possible essential configurations. Issues here are:
checkconf
(see here) approach.int genconf (KeySet * ks, Key * errorKey)
where ks
is filled with a list of all variants with the essential configuration (subkeys config
) and the changed parts of the contract (subkeys infos
).system/elektra/plugins/variants
have the same content, but take precedence. If a variant with the same name is defined, only config
or infos
from genconf
are considered if they are not mentioned in system/elektra/plugins/variants
. If the keys config
or infos
are present, it will be overwritten (deleted), if only subkeys thereof are present, it will be enhanced.config
and infos
mean:config
: The "default variant" (without any parameter) should be also available (has useful functionality)infos
: It is not possible to determine the changes of the contract, the user need to instantiate the plugin and enquiry the contract.genconf
for augeas yields: ``` access access/config access/config/lens = Access.lns access/infos access/infos/format = access aliases aliases/config aliases/config/lens = Aliases.lns aliases/config/path = /etc/aliases aliases/infos aliases/infos/format = aliases ```
genconf
for python yields: ``` configparser/config configparser/config/script = python_configparser.py ```
the user specifies: ``` system/elektra/plugins/variants/access system/elektra/plugins/variants/aliases/infos/status = 10000 system/elektra/plugins/variants/configparser system/elektra/plugins/variants/configparser/config system/elektra/plugins/variants/configparser/config/script = mybetter_configparser.py ```
then the plugin variant:
access
is not available (system/elektra/plugins/variants/access
overrides genconf
)aliases
as defined from genconf
, but with changes in contract (infos/status
)configparser
is completely redefined (result from genconf
will not be considered)genconf
API was chosen to be consistent with checkconf
. The pluginhandle might be missing for some scenarios. If it is needed, we should change both APIs for consistency reasons.genconf
needs to be implemented for the plugins:PluginDatabase
needs an extension to list all plugin variantskdb list
should be able to list all variants, e.g. like: augeas lens=Access.lns
augeas format=access
so that a user can copy and paste this for the kdb mount
command.Discussions took place here.