Bug #15590
closedBug #2613: Problem when updating a category name for Technique Management in /var/rudder
Renaming/moving technique category fails in several way
Description
We have several bugs with renaming/moving technique categories:
1/ we can't create/move a technique directly under "techniques" directory, because the active technique repo looks for "/" in place of "Active Techniques".
2/ we can't move a technique directory if is contains techniques.
1/ is trivial, 2 is complex. More details on 2
So, we don't do anything in LDAP for deleted categories that are non empty (if techniques were without directives, they are deleted, so it should not be a problem).
Because if the user has a directive, it most likely didn't wanted to delete it, and it's easier to revert a git delete than a LDAP delete.
But when we change the category ID (ie rename the directory), we actually delete the category with the previous id and create a new one with the new id. If the category has at least one directives somewhere under it.
So we need to detect at least simple directory rename and reply them in LDAP with a "changerdn" command.
A simple directory rename is a FS move where only the directory name changed, not the category "display name" nor the subentries. We will use that (category "display name" and contents) to identify a move.
We could go much farther, as in fact the only problem is the deletion of a directive. As long as all techniques containing directives are moved away from a category, there is no problem deleting it. So we could imagine scenario where a category containing techniques with directive has its directory changed, and "display name" changed, and some techniques moved elsewhere - it would be ok. We will take care of that in a later release.