Monthly Archives: April 2011

Improve Rational Team Concert import user search dialog results from a complex directory

In our company we have a hella corporate directory that provides company wide access to all kinds of great information as well as group memberships and corporate password system. The implementation is exposed via a few helpful representations but from the perspective of Team Concert we really only care about LDAP.

A challenge that I face over and over is having to import batches of users from the directory, due to the volume of the information and the complexity importing “Joe Smith” unavoidably comes up. Now we have some help here in that some attributes are guaranteed to be unique, but for the sake of better search capability a user may have 5 or 6 different cn attributes.  The limited views from the RTC search tool become very apparent with than a basic find user queries that only search common names.

Here is a quick example of the amount of variability of just a single user, in this case me.

[code]
sgw@geb:~$ ldapsearch -x -h bluepages.ibm.com -b ou=bluepages,o=ibm.com 'cn=S*Wilbur' cn mail preferredIdentity
# extended LDIF
#
# LDAPv3
# base <ou=bluepages,o=ibm.com> with scope subtree
# filter: cn=S*Wilbur
# requesting: cn mail preferredIdentity
#

# XXXXXX897, us, bluepages, ibm.com
dn: uid=XXXXXX897,c=us,ou=bluepages,o=ibm.com
mail: XXXXXXX@us.ibm.com
preferredIdentity: XXXXXX@us.ibm.com
cn: Sean G. Wilbur
cn: Shawn G. Wilbur
cn: Shaun G. Wilbur
cn: Sean Wilbur
cn: Shawn Wilbur
cn: Shaun Wilbur

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1
sgw@geb:~$

[/code]

One way that I have found to deal with this is to update the two find user ldap query attributes to include an or option for one or more of the unique attributes. Notice that these are not fuzzy searches in my case, as it made these queries slow down dramatically and for my purposes I only want the one result that it matches.

[code]
com.ibm.team.repository.ldap.findUsersByNameQuery=(|(cn\=?1*)(uid\=?1)(mail\=?1)
com.ibm.team.repository.ldap.findUsersByAnyNameQuery=(| (cn\=* ?1*) (cn\=*_?1*)(uid\=?1)(mail\=?1))
[/code]

Hope this helps!

local LAN mirror for CentOS

I find myself needing to setup RedHat like environments more and more these days and after install 4, 5, and 6 using CentOS it seems like I could get more economy if I had a simple OS level mirror on my gateway box. Did a bit of searching and surprise, surprise someone has already solved that problem. There is a good example on the CentOS mirrors page[1] that I used as the starting point, just made some minor tweaks for my environment and let it ride.

[code]
#!/bin/sh

rsync="/usr/local/bin/rsync -avqHz --delete --delay-updates" # --bwlimit=256"
mirror=msync.centos.org::CentOS
ver=5.5
archlist="i386 x86_64"
baselist="os updates"
local=/var/www/u1/pub/CentOS

for arch in $archlist
do
for base in $baselist
do
remote=$mirror/$ver/$base/$arch/
echo " Running command: $rsync $remote $local/$ver/$base/$arch/ "
$rsync $remote $local/$ver/$base/$arch/
done
done

[/code]

Thanks to jlar310 @ CentOS forums for sharing, in his one and only post back in 2006 :)

Added this to the crontab to run weekly on my soekris gateway, and now I have a local http mirror and we all lived happily ever after, the end.

Removing silly Windows cruft from perfectly good text files

Having Linux be my primary desktop environment is not without it’s challenges working in a large corporation of primarily Windows users, but when this even gets into how I have to treat text files I put my proverbial foot down!

When you see those nasty little ^M characters sneak into your party you can kick them out, a couple quick searches and you will probably find this or a similar global substitution pattern[1] that you can use inside Vim or gVim:

[code]
:%s/^M//g
[/code]

Just beware this is a control character so you really need to type:

[code]
:%s/{Ctrl+v}{Ctrl+m}//g
[/code]

Footnotes    (↵ returns to text)
  1. Removing carriage returns from MS-DOS file- http://www.oualline.com/vim-cook.html#eol