Has anyone ever tried using the CLI tool DBEDIT (which can rename objects) on the MDA to rename global objects in the global policy, AND in all the CMA Policies which use those global objects, simultaneously? Seems to me it shouldnt be too hard to write a little script (shell or perl) to do that? It would make spring cleaning in a multi-domain environment much easier...
EDIT: here is my first attempt.
2 problems so far:
a) the automatic localhost authentication doesnt work (although i'm logged in as admin on the MDA and the MDA is in the GUI access list) so I have to enter username+password every time
b) the command "mdsenv" is actually an environment variable function and doesnt work from within the script ("command not found").
Any ideas anyone?
Code:
#!/bin/sh
if [ $# -ne 2 ] ; then
echo "syntax: $0 <old_object_name> <new_object_name>"
exit
fi
oldname=$1
newname=$2
echo "rename network_objects $oldname $newname" > cross-cma-rename.scr
echo "Searching for policies containing $oldname..."
for cma in goofy hulk batman wonderwoman ; do
echo "Scanning $cma..."
count = `grep $oldname /opt/CPmds-R71/customers/$cma/CPsuite-R71/fw1/conf/objects_5_0.C`
if [ $count > 0 ]
then
echo "Found $count occurrences of $oldname in $cma! Renaming..."
mdsenv $cma
dbedit -s localhost -f cross-cma-rename.scr
fi
done
echo "Renaming object in global policy..."
mdsenv
dbedit -s localhost -f cross-cma-rename.scr
Bookmarks