-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to clean-up files as they leave the profile #14
Comments
More requirements:
{
"accounts" : {
"files": [ "/etc/passwd", "/etc/shadow", "/etc/group" ],
"cleanup-allowed" : false
}
}
|
When it comes to services configured by metaconfig (or filecopy) there may be times when you want some files cleaned up and not others, I wonder if there is a clean way of achieving this... |
Sure. Split them into two different component paths with For instance: prefix "/software/components";
"cleanable_metaconfig/cleanup-allowed" = true;
"cleanable_metaconfig/ncm-module" = "metaconfig";
"uncleanable_metaconfig/cleanup-allowed" = false;
"uncleanable_metaconfig/ncm-module" = "metaconfig"; |
Cool, my vote is for storing this in whatever backend CCM is using and extending something like ccm-query to expose this. |
Out of interest, how is a component "removed from the system"? Using the |
A component simply vanishes from the system. Its subtree in the profile disappears and its package is removed. So there is no configuration left for it to know what it should be cleaning up. Also, the With the proposal, we'll be able to track when a component is no longer present and, if it allowed to remove files, know which ones. |
So with this proposal, you'll be able to tell if a component has vanished from an updated profile, and remove some files? |
Yes. That's half of the benefits. 😄 |
Sounds like a good idea to me. Could we also have some kind of hook? A hook that is called that says a component has vanished from the profile. So if there is some other nuance we'd like to introduce as a result of a particular component being removed, we could easily code that in? |
I hadn't thought about it. It definitely makes sense. So we'd extend our schema to: {
"accounts": {
"files": [ "/etc/shadow", "/etc/group", "/etc/passwd" ],
"cleanup-allowed": true,
"remove-hook": "/bin/true"
}
} |
Yes, and send the name of the component that has been removed as an argument to the hook script, just in case we want one generic hook script that handles all components. |
I can pass the above JSON object via stdin, as I do with the ncm-ncd hooks. The script should know that, if cleanup is allowed, the files are already gone. |
That would be ok I think. If we really wanted the files to be removed last, we would set |
How do you deliver the hook script? In theory that's exactly what unconfigure() is supposed to do, but I would guess that spma would remove the component rpm before it had chance to run. But then similarly if /clean_my_component is delivered by rpm, how does spma know it should install the script briefly and then remove it again? In general this is a great idea, just pointing out that there may be some chicken-and-egg problems. :) |
I guess, in a generic RPM that bundles all your unconfigure hooks. That's how we shipped all the Icinga checks at UGent.
That's correct. Also, because there is no subtree dedicated to the component it's not possible for the component to do the right thing. Having hooks with minimal status may be a better solution.
Since it's in a generic bundle, it will stay there even if the component is not installed, or has never been relevant for that host. If you put it as part of your service/feature definition, when you unbind it, it will get uninstalled before running, and surprises will arise. (In truth, you could find your way with Yum's post-transaction-actions plugin, which I'd like to support eventually, but that's not portable and will be fragile)
The more feedback the cooler it will be. 😄 |
I see no reason why the hook script can't be part of the component package. Ok that package will get removed if a) the SPMA component runs and b) the SPMA component is configured with Now rather than having a hook script, why not just call Or perhaps we can have both. Hook scripts might be a more general concept we could develop, because they are above components and can operate on multiple components, perhaps we want to introduce more hooks this way. For example, we could have a hook script that runs if any component fails (given a list of failed components, I can see a use for that). There may be other times we could do with a hook, can't think of any more examples right now. Re Yum's post-transaction-actions, that's very Yum-specific, let's not invent things that aren't portable if we can avoid it. |
Confusingly, I thought that ncm-cdispd would detect a removed tree and Cheers, |
This is a busy issue!
Which is what will happen in most sites.
As @njwilliams states, this should be done inside ncm-cdispd. But nobody has touched it in the last six years (well, a minor change by him four years ago). I don't think we have any volonteers to redo ncm-cdispd, just for this change.
Three reasons:
None are terrible technical challenges, but it seems we lack the manpower to accomplish them all.
Indeed, making
Also, it seems Perl is not the favourite language of this community anymore. The only ones who would contribute
Hooks can be ready before the next workshop (are you going to Amsterdam?). I doubt anyone will dare to touch
We already have that. Those are the global post-configure hooks, which receive the list of components that failed or raised warnings in their input. 😄
There are two hooks here:
|
I don't think that implementing a new mechanism just because we don't know the code to ncm-cdisp very well is valid. We still have to support it so we should know it, and it makes sense that the logic to remove something is in the same place as creating something--the component. I think the logic for ncm-cdisp is fairly straight forward. When it receives a new profile:
If SPMA is set to dispatch when /software/packages changes, and ncm-$comp is removed from the tree, then the sequence of events will be that ncm-ncd --unconfigure $comp is run and then later when ncm-ncd --configure spma is run, the component package will also be removed. But that only covers the case where a component owns a config file outright, e.g. if you had an ncm-motd. If the file is created by a generic component, such as filecopy or metaconfig, then a you still need a way to clean that up when it disappears from the component's list of files. |
I agree with @ned21, decisions can't be made solely on the basis that no one will dare touch @Piojo raises a valid point however, that Perhaps when a file is created by filecopy or metaconfig, one also needs to register the name of the component that requires the file, so if that component is removed, the file can be too? |
@ned21 this discussion did indeed start as a way to clear up files no longer configured by I also agree that we shouldn't shy away from |
I'm joining this discussion very late. Can we reach some sort of (temporary) conclusion? I agree with last @jrha comment, the thing we wanted to originally addressed was removal of files no longer managed by a component (typically fileconfig/metaconfig) rather than implementing the never implemented Unconfigure(). This is pretty different from cleaning files previously managed by a removed component. I don't see clearly from the original discussion how this proposal help to handle this case. Who will be responsible to manage the file database proposed? Is it filecopy which will have the responsibility to register files in this database? In this case will probably require an extension of filecopy/metaconfig schema to define the cleanup action. |
So, the conclusion seems to be that cleaning up obsoleted files is good. And that querying which files are "owned" by Quattor components is also a good addition (one that people have been requesting for quite some time). I'll continue work on this during this week. |
Bumped to next release. |
Agreed at the workshop that this clearly not urgent, also agreed to use sqlite as a datastore. |
Bump. |
Lack of developer effort, postponed. |
|
ccm-purge was still assuming that the profile data was being stored in GDBM. This updates the call to use the correct EDG::WP4::CCM::DB indirection to handle all backends. This fixes quattor#14 on github.
With the help of quattor/CAF#10, we should be able to track which files are owned by Quattor components, and enable a clean-up infrastructure.
The use case is that components like metaconfig or filecopy create files but don't remove them when these files leave the profile. This can cause problems in, f.i, Apache, where old configurations are left behind.
The text was updated successfully, but these errors were encountered: