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.
CdmPolicyUtil
- CdmPolicyUtil is a public script include.
- Because CdmPolicyUtil is a global script include, you do not need to invoke it like a new CdmPolicyUtil().
- You can invoke CdmPolicyUtil in all scopes, but the expected invocation scope is PaCE (specifically, during the execution of PaCE policies).
- The proper call is
CdmPolicyUtil.methodName(parameters).
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.