quattor / configuration-modules-core

Node Configuration Manager Components for Everyone
www.quattor.org
Other
7 stars 56 forks source link

ncm-metaconfig: add the ability to modify configuration file inline. #699

Closed Pansanel closed 7 years ago

Pansanel commented 8 years ago

OpenStack is using many configuration files in the INI format. We may generate this configuration file with the current metaconfig module, however, doing so, we would lost the useful documentation included in the configuration file provided by OpenStack (i.e. the /etc/nova/nova.conf configuration file is provided by the openstack-nova-common RPM package). Therefore, it would be great if we can modify inline the configuration provided by OpenStack. I would recommend the use of the crudini tool (The RPM is provided by EPEL): https://github.com/pixelb/crudini

jrha commented 8 years ago

This is generally against the philosophy of Quattor, editing in place relies on prior configuration state outside of our control, which gets very messy very quickly.

If this were to be supported I think it would be cleaner to implement a dedicated component to wrap crudini.

Of course crudini could be use to merge a metaconfig generated ini-file with the original crudini --merge config_file < another.ini But that would currently require some way of triggering the update (with an init-script?).

The very best solution would be for nova (and all OpenStack services) to support conf.d directories (open an issue?).

jrha commented 8 years ago

@apdibbo may have more thoughts.

jrha commented 8 years ago

I should also add that once you start using configuration management the documentation belongs in your Pan code, not the resulting ini-files.

apdibbo commented 8 years ago

I agree with @jrha that the documentation (if needed) should be in the pan templates, however the documentation in the openstack config reference is pretty good, often better than what is in the config file. Also agree that the best solution would be to have a conf.d directory.

Pansanel commented 8 years ago

So, should we go with a new component for crudini?

stdweird commented 8 years ago

@Pansanel you should be very careful with editing files that belong to rpms other than that, @jouvin has been working on a generic editor for his dpm work. this should be similar case

jrha commented 8 years ago

I've opened an issue to provide access to a generic file-editor, but it won't get added to metaconfig.

jouvin commented 8 years ago

In fact, CAF::FileEditor has been extended (source option in 16.4) to allow restarting from a file provided for example by a RPM, if the file is more recent than the file managed by Quattor. A typical use case would be to use as a source the .new file normally created by the RPM if the config file already exists and this should be pretty safe. In addition the new CAF::RuleBasedEditor(16.4) will offer a powerful mechanism to edit files rather than create them (as said by @jrha this is a generalization of what has been used in ncm-dpmlfc and ncm-xrootd for many years). This may be a good approach for OpenStack too. It remains to be seen how we could provide a generic configuration module giving access to it to avoid the need of writing configuration modules just to access the CAF::RuleBasedEdor. I was thinking about it recently and, conversely to what said @jrha, I had in mind that ncm-metaconfig may be the right place. It would have the advantage that we continue to have only one generic configuration module to edit files and restart associated services. And looking at the schema, it could be as simple as defining the module to be RuleBasedEditor and using contents to pass the necessary contents CAF::RuleBasedEditor. Most of the schema will be relevant (only convert and preamble will not make sense) and we may have to add a rules properties to pass the rules. I'll try to come with a more elaborated proposal once 16.4 has been released.

apdibbo commented 8 years ago

In the course of doing some work in setting up our OpenStack for the EGI FedCloud I have found a number of files where editing in line like this would be really useful. I'd also tend to agree that ncm-metaconfig may be the right place to do this.

These are files where we only really need to edit one or two lines for example the policy json files and the api pastebin files for OpenStack

jouvin commented 8 years ago

As per the discussion at the workshop, agreement that whether RBE can be added as another module to ncm-metaconfig (as proposed in https://github.com/quattor/configuration-modules-core/issues/699#issuecomment-219550803) without messing up its schema remains an open question and that the first step is to fork ncm-metaconfig and to implement the solution I poprosed. Based on the result, we'll see if it makes sense to merge it into ncm-metaconfig or if it is better to keep it as a separate component... I'll try to propose a PR for 16.10.

jouvin commented 7 years ago

Work to be done tracked into #949