Adding warning and failure messages to validation results — CdmPolicyUtil
You use the CdmPolicyUtil script include to add warning and failure messages to validation results in the CDM Policy Validation Results table. CDM expects validation warnings and failures to contain a node path, a snapshot ID, and a reference to the impacted node.
Important: Starting with the Washington D.C. release, DevOps Config is being prepared for future deprecation. It will be hidden and no longer activated on new instances but will continue to be supported.
CdmPolicyUtil
CdmPolicyUtilis a public script include.- Because
CdmPolicyUtilis a global script include, you do not need to invoke it like a new CdmPolicyUtil(). - You can invoke
CdmPolicyUtilin all scopes, but the expected invocation scope is PaCE (specifically, during the execution of PaCE policies). - The proper call is
CdmPolicyUtil.methodName(parameters).
Note: If you add warning and failure messages to validation results manually instead of using CdmPolicyUtil, the snapshot validation status will show Execution Error.
Methods
addFailure
Adds a failure message. The message appears on the Validation results tab for the snapshot.
Parameters:
- Output: Policy decision for the subject snapshot (primarySnapshotId).
- cdmNode: Node (sn_cdm_node) that caused the failure.
- name: Name of the failure.
- description: Description of the failure.
- addWarning
Adds a policy warning message. The message appears on the Validation results tab for the snapshot.
Parameters:
- Output: Policy decision for the subject snapshot (primarySnapshotId).
- cdmNode: Node (sn_cdm_node) that caused the warning.
- name: Name of the warning.
- description: Description of the warning.
- getLastCreatedSnapshotIds
Returns the latest created and published snapshot IDs for the supplied additionalDeployables. If no published snapshot is available for a particular deployable, adds a debug message.
Parameter:
additionalDeployables – can be passed directly as it comes to the policy.
getLastPublishedSnapshotIds
Retrieves the latest and published snapshot IDs for the supplied additionalDeployables. If no published snapshot is available for a particular deployable, adds a debug message.
Parameter:
additionalDeployables - can be passed directly as it comes to the policy.