quattor / configuration-modules-core

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

ncm-symlink: full rewrite needed #683

Open jouvin opened 8 years ago

jouvin commented 8 years ago

ncm-symlink deserves a full rewrite based on getTree() API and addressing all the ncm-symlink issues currently open, in particular #288 about ensuring that a symlink definition cannot be added twice to the configuration, leading to unpredictable results.

ned21 commented 8 years ago

@jouvin Are you planning a new component so people can run them side-by-side during the transition? cf. #648 I think it would be worth considering having a single component that combines both symlink and dirperm since at present it's perfectly possible to get yourself into a situation where dirperm and symlink try to replace the same path, and the ordering of dirperm and symlink is dependent on how a site configures their depends.

jouvin commented 8 years ago

Currently I was more thinking at rewriting symlink in such a way that it is based on a dict and still remain backward compatible with the old schema (I have not tested my ideas but I think it should be doable). But I have also been thinking that it could be good/useful to merge dirperm and symlink.We could use the ncm-system approach with ncm-chkconfig: a new configuration modules with a clean schema able to digest the schema of the legacy configuration modules. What do you think about it?

jouvin commented 8 years ago

One of the question regarding the schema is the need, if any, of operation ordering. I think the reason for using a list rather than a dict in both configuration module was to be able to address this need. If moving to a dict, it would be painful to invent a complex dependency description... Can we consider that processing the dict entries in the key alphabetical order (the key being the path) is enough? I tend to think that yes as I think the only important thing is to ensure you process the parents before the children...

stdweird commented 8 years ago

for the rewrite, a few remarks/requests

jouvin commented 8 years ago

I think we basically agree. Personally, not surprising, I think that if we start a new component (and I think this is a good proposal), ensuring backward compatibility with components it replaces is critical. In the template library for example both of these configuration modules are used a lot and it would be too much time trying to edit any template to get rid of the legacy config modules. My idea is a new component, probably with a new schema, that register for changes to the configuration part of the legacy ones and do what is appropriate to process the information provided according to the schema of the legacy components (probably converting it to the new one when starting to keep the code clean). I'll see if I managed to come with a prototype in the coming weeks...

ned21 commented 8 years ago

In terms of order of processing, my thought was that sorting the paths by length of components and processing in order of increasing length would be both useful and safer? At the moment I think you can run into problems where a symlink higher up the tree can cause dirperm to have different effects depending on the order in which the components are run. To give an example/unit test:

symlink = /var/foo -> /opt/foo
directory = /var/foo/bar, mode  = 1777

should result in /opt/foo/bar with mode 1777 because /var/foo has fewer components than /var/foo/bar and therefore /var/foo is processed first.

jouvin commented 8 years ago

Good remark! The sorting order may be added as an option.