
V Mon, 4 Nov 2019 13:19:29 +0100 Thorsten Kukuk <kukuk@suse.de> napsáno:
On Mon, Nov 04, Imobach González Sosa wrote:
On Mon, 2019-11-04 at 09:39 +0100, Thorsten Kukuk wrote:
On Mon, Nov 04, Andrei Borzenkov wrote:
Hi all,
I wonder was it coordinated with YaST?
Yes, it was, but as nobody really knows which files YaST is reading we clearly missed some files.
Yes, YaST reads or writes quite a lot of files[1], especially under /etc/sysconfig.
YaST should use libeconf to read login.defs, like shadow, util-linux and pam do already.
The problem I see with libeconf is that, as far as I understood, it only supports key=value configuration files (as it is stated in the project's README[2]). That's fine for many configuration files (like sysconfig, login.defs, etc.), but I am not sure whether it will be good enough for other cases (ini files -having sections into account-, YAML- like (Salt), JSON (docker), etc.).
The whole stuff makes only sense with ini style files.
Hi thorsten, I am a bit lost here. Do you mean with this statement that libeconf makes sense only with ini files? Or that whole /usr/etc is intended for ini files? Or that merging makes sense only for ini files?
Why not using augeas (or any other similar library) to parse the files instead of rolling our own? libaugeas and its lenses are quite small.
The parser is far the smallest part, and we haven't found anything which is merging the configuration files in the way we need it (the systemd developer were not willing to provide their code as standalone library or make the interface public).
As Imo write, our approach with augeas is that we get configuration tree and do operation on top of that tree like merging and we get final result and it also allows various strategy for merging as we learned, that sometimes logic is quite complicated and merging is not just about /etc and /usr/etc, but in fact also various conf.d directory that do config snippets that can overwrite. We pick augeas due to number of existing parsers and also ability to edit with minimal changes. That allows us to share with upstream various fixes and faster react to changes in configuration. I just worry that your parser is small only as long as you not handle all possible corner cases of configuration formats. Know problems even with simple ini files we face so far are windows line ending, strange characters, escaping and various format extensions. Josef
Thorsten
The YaST team has a Ruby gem[3] that offers a high level API to configuration files using augeas to parse them. As a proof of concept, we already implemented support to behave more or less like libeconf. But I would be great if we could join forces and reduce code duplication. Of course, we could rely on libeconf when possible and use augeas when needed...
Regards, Imo
[1] https://etherpad.suse.de/p/yast-usr-etc [2] https://github.com/openSUSE/libeconf/blob/master/README.md [3] https://github.com/config-files-api/config_files_api [4] https://github.com/config-files-api/config_files_api/pull/32
-- Thorsten Kukuk, Distinguished Engineer, Senior Architect SLES & MicroOS SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany Managing Director: Felix Imendoerffer (HRB 36809, AG Nürnberg) -- Imobach González Sosa YaST Team at SUSE LINUX GmbH https://imobachgs.github.io/
-- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org