Modifying Out-of-the-Box Scripts

When making out-of-the-box script modifications, make only minimal changes to the script and place any necessary methods in an external script. You can track changes more efficiently and, when moving to a newer Universal CMDB version, your code is not overwritten.

For example, the following single line of code in an out-of-the-box script calls a method that calculates a Web server name in an application-specific way:

serverName = iplanet_cspecific.PlugInProcessing(serverName, transportHN, mam_utils) 

The more complex logic that decides how to calculate this name is contained in an external script:

# implement customer specific processing for 'servername' attribute of httpplugin 
def PlugInProcessing(servername, transportHN, mam_utils_handle): 
        # support application-specific HTTP plug-in naming 
        if servername == "appsrv_instance": 
                # servername is supposed to match up with the j2ee server name, however some groups do strange things with their 
                # iPlanet plug-in files. this is the best work-around we could find. this join can't be done with IP address:port 
                # because multiple apps on a web server share the same IP:port for multiple websphere applications 
                logger.debug('httpcontext_webapplicationserver attribute has been changed from [' + servername + '] to [' + transportHN[:5] + '] to facilitate websphere enrichment')
                servername = transportHN[:5] 
        return servername

Save the external script in the External Resources folder. For details, see Resources Pane. If you add this script to a package, you can use this script for other jobs, too. For details on working with Package Manager, see Package Manager.

During upgrade, the change you make to the single line of code is overwritten by the new version of the out-of-the-box script, so you will need to replace the line. However, the external script is not overwritten.

Parent topic: Create Jython Code