User story #2422
closedCreate a migration script for ldap-inventory and rudder to add entries in the ldap trees and update the configuration.properties files
Description
As per #2094, new entries appeared in the ldap tree
## Same structure, for removed inventories (after deletion) dn: ou=Removed Inventories,ou=Inventories,cn=rudder-configuration objectclass: top objectclass: organizationalUnit ou: Removed Inventories description: Store inventories removed from Rudder # Machines, pending @ example.org dn: ou=Machines,ou=Removed Inventories,ou=Inventories,cn=rudder-configuration objectClass: top objectClass: organizationalUnit ou: Machines description: Containers for servers from ou=Nodes, such as physical machines or virtual machines. # Nodes, pending @ example.org dn: ou=Nodes,ou=Removed Inventories,ou=Inventories,cn=rudder-configuration objectClass: top objectClass: organizationalUnit ou: Servers description: Logical servers, an OS installation. May be on a virtual machine or a physical machine, from ou=Machines.
and in the configuration.properties (in both project) files needs this new entries :
ldap.inventories.removed.basedn=ou=Removed Inventories, ou=Inventories, cn=rudder-configuration
Updated by Nicolas PERRON over 12 years ago
- Status changed from 8 to Pending technical review
- % Done changed from 0 to 100
Applied in changeset commit:1721800bc1a1d2b271f59330ce96b1526029535e.
Updated by Jonathan CLARKE over 12 years ago
- Status changed from Pending technical review to Discussion
I do not think that this test is optimal:
LDAP_TEST_REMOVED_INVENTORIES=$(/opt/rudder/sbin/slapcat 2>/dev/null | grep "Removed Inventories" | wc -l) if [ ${LDAP_TEST_REMOVED_INVENTORIES} -ne 4 ]; thenIn fact, it is dangerous, for several reasons:
- The number of lines matched will be variable depending on the number of nodes removed... each one will add one to this number, causing your test to fail, and attempt to re-add these entries, thus making the rudder-upgrade script fail.
- Matching a short piece of full text like "Removed Inventories" on the whole contents of the LDAP directory is very imprecise. What if someone creates a Directive with "Removed Inventories" in the description? It will be matched and cause this test to be wrong.
A better test can be acheived by matching the exact line you're looking for, and one that is unique, maybe something like this:
LDAP_TEST_REMOVED_INVENTORIES=$(/opt/rudder/sbin/slapcat 2>/dev/null | grep '^dn: ou=Removed Inventories,ou=Inventories,cn=rudder-configuration$' | wc -l) if [ ${LDAP_TEST_REMOVED_INVENTORIES} -ne 1 ]; then
Updated by Nicolas PERRON over 12 years ago
Jonathan CLARKE wrote:
I do not think that this test is optimal:
[...]
In fact, it is dangerous, for several reasons:
- The number of lines matched will be variable depending on the number of nodes removed... each one will add one to this number, causing your test to fail, and attempt to re-add these entries, thus making the rudder-upgrade script fail.
- Matching a short piece of full text like "Removed Inventories" on the whole contents of the LDAP directory is very imprecise. What if someone creates a Directive with "Removed Inventories" in the description? It will be matched and cause this test to be wrong.
A better test can be acheived by matching the exact line you're looking for, and one that is unique, maybe something like this:
[...]
Ok, you're right. I thought that "Removed Inventories" will be unique to 4 entries but I was wrong. I will do a more precise test like you suggested.
Updated by Nicolas PERRON over 12 years ago
- Status changed from Discussion to Pending technical review
Updated by Jonathan CLARKE over 12 years ago
- Status changed from Pending technical review to 10
Looks good to me now.
Updated by Nicolas PERRON almost 12 years ago
- Project changed from Rudder to 34
- Category deleted (
11)
Updated by Benoît PECCATTE almost 10 years ago
- Project changed from 34 to Rudder
- Category set to Packaging