Project

General

Profile

Actions

User story #2422

closed

Create a migration script for ldap-inventory and rudder to add entries in the ldap trees and update the configuration.properties files

Added by Nicolas CHARLES about 12 years ago. Updated about 9 years ago.

Status:
Released
Priority:
1
Assignee:
Nicolas PERRON
Category:
Packaging
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:

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


Related issues 1 (0 open1 closed)

Related to Rudder - Bug #2627: The upgrade from Rudder 2.3 to Rudder 2.4 doesn't work as LDAP DIT has not been correctly migratedReleasedNicolas PERRON2012-07-03Actions
Actions #1

Updated by Nicolas PERRON about 12 years ago

  • Status changed from 8 to Pending technical review
  • % Done changed from 0 to 100

Applied in changeset commit:1721800bc1a1d2b271f59330ce96b1526029535e.

Actions #2

Updated by Jonathan CLARKE about 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  ]; then
In fact, it is dangerous, for several reasons:
  1. 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.
  2. 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
Actions #3

Updated by Nicolas PERRON almost 12 years ago

Jonathan CLARKE wrote:

I do not think that this test is optimal:

[...]

In fact, it is dangerous, for several reasons:
  1. 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.
  2. 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.

Actions #4

Updated by Nicolas PERRON almost 12 years ago

  • Status changed from Discussion to Pending technical review
Actions #5

Updated by Jonathan CLARKE almost 12 years ago

  • Status changed from Pending technical review to 10

Looks good to me now.

Actions #6

Updated by Jonathan CLARKE almost 12 years ago

  • Status changed from 10 to Released
Actions #7

Updated by Nicolas PERRON about 11 years ago

  • Project changed from Rudder to 34
  • Category deleted (11)
Actions #8

Updated by Benoît PECCATTE about 9 years ago

  • Project changed from 34 to Rudder
  • Category set to Packaging
Actions

Also available in: Atom PDF