Skip to content

plugin: Execute Multiple DCM Targets

Nick Mathison edited this page Jul 26, 2017 · 2 revisions

Execute Multiple DCM Targets via single plug-in step

The DataPower Configuration Manager's (DCM) Ant command line interface, which the DataPower plug-in is based on, utilizes the deploy.ant.xml. As with other Ant based commands, you can run multiple targets in a single command.

For example, if you wanted to run the upload-from-def and import-from-def targets, your bash command may look like this:

ant -f deploy.ant.xml -Ddcm.dir=dcm.jar -Dhost=datapower.server.ibm.com -Duid=admin -Dpwd=admin -Ddomain=default \
    -Dupload.file=upload_dcm_deployment_policy.xml -Dimport.changes.file=import_dcm_deployment_policy.xml \
    -Dimport.file=datapower_config_export.zip  -Dcapturesoma=capture_soma.txt -Dall.files=true \
    -Dignore.error='No access to file' upload-from-def import-from-def

When running running commands quickly, this approach makes sense as you will not need to retype many of the same arguments. (ie -f deploy.ant.xml, -Ddcm.dir=dcm.jar, or username and password) For plugins, we have two different approaches for managing this type of behavior.

Shell Step

The basic Shell plug-in and steps is a common approach for running terminal commands within an IBM UrbanCode Deploy process. Using the Shell step, you can run any DCM command within a shell step, regardless of whether or not it is available in the DataPower plug-in. It is important to remember that these commands will be run relative to the UCD agent's working directory. By default this folder is located at <agent_install>/var/work/<Process/Component Name>. Therefore, files such as the dcm.jar, import_dcm_deployment_policy.xml, and upload_dcm_deployment_policy.xml` will need to be located in this directory or their paths updated with the absolute path. Like all other IBM UrbanCode Deploy steps, you can take advantage

Sample Shell Step Configuration with two targets

Multiple Plugin Steps

We do not support running multiple DCM Ant targets in a single plug-in step. As two steps can simply be placed together in a process, this concept does not make sense. Furthermore, with the use of Component Templates and/or Properties, property management will be minimal. For example, you can reference a property once at the Application, Component, Process, or Resource level, and then access it within any step that pertains to the process context level. Then with component templates, you can structure processes with their values already set with values or properties. Once defined, these values will dynamically update all referenced steps properties during runtime.

The two screenshots below demonstrate a possible configuration for the Import (Definition) plug-in step which uses the import-from-def Ant target. In the configuration, you can see multiple properties defined by the ${p:PROP_NAME} form. Complete syntax for other properties can be found in the Properties documentation.

Import (Definition) Plug-in Step Configuration

The next screenshot shows where these properties are specified. This example shows where to define them for a Process configuration. Similarly to other Application, Component, or Resource properties, they are defined under their corresponding Configuration tab. If we created a new DataPower step, we can reuse the same ${p:PROP_NAME} syntax to define these same properties. With this approach you can see that specifying multiple targets in a single plug-in step would limit that steps use cases and would overshadow functionality that already exists in IBM UrbanCode Deploy.

Sample Process Property Configuration