ClearCase Support: Installing and Implementing ClearCase Triggers
A ClearCase Trigger is simply a script that runs whenever a ClearCase action is performed. Triggers are completely customizable by the ClearCase Admins (VOB owner). Triggers can run before (preop) or after (postop) a ClearCase action. By default, ClearCase does not have any triggers turned on.
For example, if we would want to implement a trigger that will prevent users from permanently deleting ClearCase elements from the VOB using the "cleartool rmelem" command, here is one possible solution.
First, this is how to install a UNIX trigger, called "rmelem_trigger", on the VOB called "/vob/test". The trigger is actually a Perl script at this location "/clearcase/rmelem_trigger.pl".
cleartool mktrtype -nc -element –all -preop rmelem -execunix "/usr/local/bin/perl /clearcase/rmelem_trigger.pl" rmelem_trigger@/vob/test |
---|
In an environment with multiple types of operating systems, you may need to install a second trigger script. For example, here is the same installation command while running a different executable for Windows would be:
cleartool mktrtype -nc -element –all -preop rmelem -execunix "/usr/local/bin/perl /clearcase/rmelem_trigger.pl" -execwin "\\\\network_machine\\shar_directory\\perl\\perl.exe \\\\network_machine\\shar_directory\\rmelem_trigger.pl" rmelem_trigger@/vob/test |
---|
An example of the trigger script in Perl for UNIX would be:
If the script exits with a status of "0", then the ClearCase Trigger action (cleartool rmelem) is executed. If the script exits with a status of "1", then the ClearCase Trigger action is NOT executed. Of course, the Windows Perl script needs to be written too.
To un-install a ClearCase trigger, use this command:
cleartool rmtype -force trtype:rmelem_trigger@vob:/vob/test |
---|
by Phil for Humanity
on 03/10/2008