ComplianceJob - createRemediationJobFromComplianceResultByRule_1
ComplianceJob - createRemediationJobFromComplianceResultByRule
Description :
This command creates a Remediation Job based on all the information collected from a Compliance Job result.
The compliance target(s) will be picked from a Compliance Job run based on template, rule, and component in that order. If you do not provide any information on template/rule/component, then the Remediation Job will be based on all the template/rule/component information in the Compliance Job result. If you give only template information("" for rule/component), then the Remediation Job will be based on all the rule/components in this template. If you give both template and rule information("" for component), then the Remediation Job will be based on all the components under the given rule in the template. If you provide all template, rule, and component information, then the Remediation Job will be based on only the component in the rule of this template. If you mark useComponentDeviceForTargets argument true, then the remediation job created will only have devices as targets and not the individual components of the compliance job. This command returns a handle to the newly created job. This handle can be used as input to commands that need a handle to the job.
Return type : DBKey
Command Input :
Variable Name | Variable Type | Description |
|---|---|---|
remediationName | String | Name of the package. |
jobGroupName | String | Name of a group that should contain the new remediation job(s). |
depotGroupName | String | Name of a group that should contain the new package(s). |
compJobKey | DBKey | Handle to the Compliance Job whose job run result you want to package. |
compJobRunId | Integer | ID of the Compliance Job run whose result you want to package. |
templateGroupName | String | Group name of the template used in the Compliance Job run. |
templateName | String | Name of the template used in the Compliance Job run. |
ruleGrpName | String | Name of the template rule group used in the Compliance Job run. |
ruleName | String | Name of the template rule used in the Compliance Job run. |
targetComponent | String | Name of the target component. |
useComponentDeviceForTargets | Boolean | Use the device of a component as the target of the remediation - true(default) = devices are targets. |
keepUniquePackageProps | Boolean | Indicate if the package should uniquely save each local property for the compliance rule packages that are used |
Example
This example shows how to create a Remediation Job from a Compliance Job run result. It assumes that a Compliance Job (compliance1) has been run. The target list of the remediation job will be the list of devices associated with the components.
Script
COMP_JOB_DBKEY=`blcli ComplianceJob getDBKeyByGroupAndName /jobgroup1 compliance1`
# Job run index of the Compliance Job run.
COMP_JOB_RUN_ID="1"
# Name of the Remediation Job.
REMEDIATION_JOB_NAME="remediationJob1"
# Name of the job group where the new job is going to be saved.
JOB_GROUP_NAME="/job_group_name"
# Name of the depot group where the new package is going to be saved.
DEPOT_GROUP_NAME="/depotGroup"
# Name of the template group.
TEMPLATE_GROUP_NAME="/templateGroup1"
# Name of the template.
TEMPLATE_NAME="template1"
# Name of the template rule group.
RULE_GROUP_NAME="ruleGroupNo1"
# Name of the template rule.
RULE_NAME="ruleNo1"
# Name of the target component.
TARGET_COMPONENT="template1 [Inst1] (engwin2kagt1)"
# Now create new package.
PACKAGE1_DBKEY=`blcli ComplianceJob createRemediationJobFromComplianceResultByRule $REMEDIATION_JOB_NAME $JOB_GROUP_NAME $DEPOT_GROUP_NAME $COMP_JOB_DBKEY $COMP_JOB_RUN_ID $TEMPLATE_GROUP_NAME $TEMPLATE_NAME $RULE_GROUP_NAME $RULE_NAME $TARGET_COMPONENT true true`