ComplianceJob - createComponentBasedComplianceJob
ComplianceJob - createComponentBasedComplianceJob
Description :
This command creates a Compliance Job based on a component.
You must provide an ID for the job group that will contain this Compliance Job. You can find this using JobGroup : groupNameToId .
The templateKey argument provides a DBKey identifying the template that describes the assets on which the Compliance Job is based.
The serverName argument identifies the target of the Compliance Job. You can add target servers or target groups to the Compliance Job using Job : addTargetServer or Job : addTargetGroup . This command returns a handle to the newly created Compliance Job. The DBKey can be used in other commands that need to reference the Compliance Job you have created.
Return type : DBKey
Command Input :
Variable Name | Variable Type | Description |
|---|---|---|
jobName | String | Name of the job to be created. |
groupId | Integer | ID of the parent job group for the Compliance Job. |
templateKey | DBKey | Handle to the template describing the assets to be included in the Compliance Job. |
serverName | String | Target server for the Compliance Job. |
componentIndex | Integer | Index of the component on the target server (typically 0). |
Example
The following example creates a template-based Compliance Job. A server group is also added as a target. For this example, a component template must already exist, and a component must have already been discovered on the target server.
Script
SERVER_ID=`blcli Server getServerIdByName $TARGETSERVER`
JOB_GROUP_ID=`blcli JobGroup groupNameToId /Compliances`
TEMPLATE_KEY=`blcli Template getDBKeyByGroupAndName /filesystem basefiles`
COMPONENT_KEY=`blcli Component getComponentKeyByTemplateKeyAndServerId $TEMPLATE_KEY $SERVER_ID`
JOB_KEY=`blcli ComplianceJob createComponentBasedComplianceJob basefilesnap $JOB_GROUP_ID $TEMPLATE_KEY $TARGETSERVER 0`
JOB_KEY=`blcli Job addTargetGroup $JOB_KEY $TARGETGROUP`