quattor / aii

Automated Installation Infrastructure
www.quattor.org
Apache License 2.0
7 stars 16 forks source link

Implement auto-cleanup of deleted hosts #303

Open gombasg opened 5 years ago

gombasg commented 5 years ago

aii-shellfe has the --remove and --removelist options for cleaning up hosts which are no longer needed. However, these options work only if the host still exists, because they check the hostname against profiles-info.xml, and try to refresh the host profile. So these options cannot be used for cleaning up hosts which have already been deleted.

It would be useful to have an option to automatically clean up hosts which are no longer mentioned in profiles-info.xml, but which still have a profile cached under /var/quattor/cache. This cleanup variant should use the last available cached profile, and it should not try to update it (justification: the profile may not exist anymore, and even if it does exist, the various configuration files under /tftpboot and elsewhere were created using the cached version of the profile, so the cleanup should use the same information).

Actually, it could be argued that even --remove and --removelist should avoid trying to refresh the profiles of the hosts being removed, exactly because the items to clean up should be dictated by the already downloaded profile, and not any newer one.

stdweird commented 5 years ago

@gombasg about not checking the template on --remove, i'm not in favour, because we have remove hooks, and you never know you want to fix them before removing/reinstalling the host. i propose we add a --cleanup option to handle missing profiles

gombasg commented 5 years ago

@stdweird well, I said it can be argued about :-) I could imagine a hybrid solution, like --remove refreshing the profile if the host is still present in profiles-info.xml, and using the last cached profile otherwise. I only took a quick look at the code though, so I don't know which solution would be easier to implement.