Bug #6840

Updated by François ARMAND almost 6 years ago

 When we edit a rule category with the little pen that appears on mouse over the category name, then the category XML file on /var/rudder/configuration-repository/ruleCategories is removed.  

 The corresponding commit message is: 

   Move archive of node group category with ID 'aaab98ef-8d7d-4948-9213-13ed93df8ebf' 

 Of course, it's the first silent move that leads to Ragnärok and a chess mate in one move: from that point, if the user use the archive -> restore [rules] -> from last commit; then the category disapear, and any rule that uses it will have a wonderfull "ERROR" as a category name.  

 This is bad, developpers ! 

 It was reproduce in 2.10 and 3.0. 

 Procedure to restaure rule categories deleted during a restore: 
 $ cd /var/rudder/configuration-repository 
 # find candidate rule categories (deleted with a "move" message) 
 $ git log --diff-filter='D*' --grep="Move archive" --format=format:%H ruleCategories > /tmp/possible_categories.txt 
 # find rule really moved and not deleted due to the bug 
 $ git log --diff-filter='A' --grep="Move archive" --format=format:%H ruleCategories > /tmp/real_move.txt 
 # restore rule categories on the fs 
 $ for i 3.0, but there is no reason that our silent killer won't be in $(grep -v -f /tmp/real_move.txt /tmp/possible_categories.txt); do git show --no-color $i | patch -p1 -R; done 2.10.x 
 # add them back in git 
 $ git add ruleCategories/ 
 $ git commit -m "restore categories from bug" 

 And then, go to utilities -> archive, and "restore rules" from "latest git commit" in the dropdown list.