12.2. modifyConfig

The modifyConfig task updates the DataPower configuration from the provided configuration file and/or the configuration information specified inline within the configuration tag. The configuration information contains DataPower object definitions in the format defined by the DataPower schema (xml-mgmt.xsd, “AnyConfigElement” type).

As with import, you can use DataPower export facility or DPBuddy’s export task to produce an initial version of the configuration file.

Also similar to import, the configuration can be transformed using DPBuddy’s transform actions.

Configuration can contain variables in any of its text nodes or attributes.

Unlike import, however, modifyConfig does not completely overwrite existing configuration objects. Instead, it updates nested elements of the configuration. For example, for a load balancer group (LBG), modifyConfig will update only the members included in the request. If an LBG member does not exist, modifyConfig will create it. It will not affect any other group members.

DataPower XML schema contains the following explanation for modifyConfig:

“Vectors with indexes (example: BaseWSDL in ModifyWSGateway) will be merged based on matching index values (example: WSDLSourceLocation for BaseWSDL). Vectors without indexes (example: DebugTrigger in ModifyConfigBase) and simple vectors (example: AcceptedConfig in ModifyConfigDeploymentPolicy) will have all their elements replaced with any new elements supplied via modifyConfig.”

You can use modifyConfig to dynamically change your configuration, for example, to disable LBG members if you need to shut down some back-end servers.

Please note that DataPower forces XML validation of “modifyConfig” requests (it does not do it for import). Unfortunately, in some cases, DataPower produces a non-compliant XML export, which causes validation to fail. Usually, removing the “Memoization”, “DebugMode” and “DebuggerType” elements is sufficient to let it pass. Also, all ports elements (e.g., “HealthPort” in “LBGroupMembers”) must have an integer value; you can enter “0” to default these values.

modifyConfig will try to validate the request against the DataPower XML schema on the client (you can override this by setting the validate attribute to false). If the schema validation was turned off, the validation would still fail on the device and you would get the “Internal Error” message.

Paying (i.e. non-trial) DPBuddy customers can contact DPBuddy support if they have questions or issues with defining their modifyConfig requests.

12.2.1. Attributes/Option

Attribute Description Required
file

Path to the configuration file. If the task contains transform element, the transformations will be applied to the content of the file.

The file must be a valid DataPower configuration file. datapower-configuration must be the root element. All configuration objects must be enclosed inside the configuration element, which must be a child of datapower-configuration.

No
resolveVars

If set to true, attempts to resolve variables (${}) inside the configuration. DPBuddy will raise an exception if any variables/properties remain unresolved.

Defaults to true.

No

12.2.2. transform Nested Element

transform contains transformation actions documented in Using DPBuddy to Transform DataPower Configuration and XML Files. This element is optional.

12.2.3. fileset Nested Element

You can use the Ant fileset element to specify multiple config files that will be used to update DataPower configuration. DPBuddy will combine all matching files into a single request to the device. You can specify multiple fileset elements within the same task.

Each fileset could contain a nested transform element with the transformation actions. The actions will be applied to the files matched by this fileset. Note that the global transform specified as the child of the task will not be applied to the matching files.

12.2.4. configuration Nested Element

You can specify any valid DataPower configuration inside this element as an alternative to keeping the configuration in an external file. If the task contains transform element, the transformations will be applied to this configuration. The configuration’s text nodes and attributes can contain Ant variables.

12.2.5. Examples

The following example shows how to use modifyConfig to disable an LBG member:

<dp:modifyConfig>
    <configuration>
        <LoadBalancerGroup name="${lbg.name}">
            <LBGroupMembers>
                <Server>${server.name}</Server>
                <Weight>1</Weight>
                <MappedPort>0</MappedPort>
                <Activity/>
                <HealthPort>0</HealthPort>
                <LBMemberState>disable</LBMemberState>
            </LBGroupMembers>
        </LoadBalancerGroup>
    </configuration>
</dp:modifyConfig>