Elektra
0.9.4
|
The vision of Elektra is to have systems in which every configuration setting is easily accessible and specifiable.
We will use Samba and its configuration value global/workgroup
as running example.
Currently, the administrator would first need to locate the configuration file, it could be /etc/samba/smb.conf
, learn the syntax and then implement some configuration management code to add or replace the value. Furthermore, application developers need to implement the parser, design tools like SWAT, and document in detail how to configure their specific software. This is a huge effort on both sides.
We envision, that instead a key-value interface allows us to change any configuration value as desired.
Either by either invoking command-line tools:
Also by importing an INI file with the information:
Or using some compiled language like C (shown code uses the high-level API, with neither code generation nor error handling):
Or using some interpreted language like Python (shown code uses the Python binding of the low-level API):
Or if you already use configuration management tools, the vision is that a single statement within the configuration management tool suffices to change a configuration value.
Key-value access in puppet-libelektra:
Key-value access in Chef:
Key-value access in Ansible:
In all these examples, we have set system:/sw/samba/#0/current/global/workgroup
to MYGROUP
.
Different to other solutions, in Elektra applications itself can be integrated, too. In Samba we would simply replace the configuration file parser with code like (low-level C code, no error-handling and no cleanup):
If any of the codes above were executed, the application will print My workgroup is MYGROUP
.
Applications that were modified to directly use Elektra are called to be elektrified
.
But the vision also includes legacy applications which do not directly use Elektra. Then distributions can mount configuration files, so that the configuration is visible within Elektra.
Elektra uses the same configuration to configure itself, so every way shown above can be used. To make mounting more simple, we introduced an extra tool:
Mounting can also be done via configuration management tools.
Mounting in puppet-libelektra:
Mounting in Ansible:
Ideally, applications specify their settings. This way, we know which keys exist on a system and which values are expected for these keys. Then administrators do not need to guess.
Next to the documentation for humans, specifications also provide information for software. For example, the Web UI automatically gives input fields according to the type of the configuration setting. For example, a boolean configuration setting gets a checkbox.
Also the specifications are integrated within Elektra in the same way. Again, we can use any of the above ways to specify configuration.
Either by either invoking command-line tools:
Key-value specifications in puppet-libelektra:
Note, that the specification (in both examples above) actually lands up in spec:/sw/samba/#0/current/global/workgroup
. The unique path to the configuration setting is /sw/samba/#0/current/global/workgroup
, but the specification gets written to the namespace spec
, while the system-configuration gets written to the namespace system
.
Here we have shown how Elektra can be used to configure systems more easily. Both application developers and administrators can save time.
The main technique to achieve the vision is unique key names: Every configuration setting can be addressed by its unique key name.
With this unique key name, we get an identifier, which can be used at all places throughout the system.