BlPackage - importAuditTargetToPackage_1
This command adds all the information collected from an Audit Job result to a BlPackage.
The audit target will be picked from an audit based on the template specified as input to this command with the matched target component name. If you do not provide a target component name, this command fails if the audit result has multiple targets for the same template.
If there is software in the audit result needed to match to depot software, the command will try to find the match specifed in the match mapping file. If the command cannot find it, or you did not provide a software matching file, the command will try matching to default depot software. If the command cannot find default depot software, it skips the software.
The software matching file is a comma seperated text file, where each line contains a software name followed by the depot software DBKey. (To get the DBKey of depot software, you can use the Depot Object : getDBKeyByTypeStringGroupAndName command.)
Here is a sample line from a software matching file:
"AdventNet SNMP Utilities 4","DBKey:SDepotObjectKey:3-1"
Audits can have several templates specified in them. For each template, the audit can have one master and several targets.
This command lets you choose have the Property Overwriting recursively set the value for all children objects. This command returns a handle to the newly created package and can be used as input to commands that need a handle to the package.
Return type : DBKey
Command Input :
Name of a group that contains the package.
Name of the package.
True to create a package soft linked to the depot object resources, false otherwise.
True to package the file ACLs, false otherwise.
True to package the file attributes, false otherwise.
True to package the file contents, false otherwise.
True to package the registry ACLs, false otherwise.
Handle to the Audit Job result you want to package.
Handle to the template that should be packaged in the audit.
Names of the component item properties whose values you want to set. These are the property names that appear in the BLPackage editor in the BMC BladeLogic GUI. If you want to set more than one property, use a comma to separate multiple property names.
The values you want to assign to the properties listed in propNames. Note that you can use parameters here, as well as explicit values. Separate multiple values/parameters with commas. The first value corresponds to the first property, the second value corresponds to the second property, and so on.
Name of the target component.
NSH path of the matching software file.
True to recurse over all package contents to set the properties.
This example shows how to create a BLPackage from an audit. It assumes that an Audit Job (audit1) has been run and a handle for that run has been stored (AUDIT1_RUN_DBKEY): This example causes the property setting to re cursively set the value on all the children
# Get audit result from audit run DBKey. AUDIT1_DBKEY=`blcli AuditJob getDBKeyByGroupAndName /jobgroup1 audit1` AUDIT1_RUN_DBKEY=`blcli JobRun findLastRunKeyByJobKey $AUDIT1_RUN_DBKEY` AUDIT1_RESULT_DBKEY=`blcli JobResult findJobResultKey $AUDIT1_RUN_DBKEY` # Name of the package. PACKAGE_NAME="package1" # Get the ID of the depot group in which the package will be saved. DEPOT_GROUP_NAME=/parent/group1 DEPOT_GROUP_ID=`blcli DepotGroup groupNameToId $DEPOT_GROUP_NAME` # This boolean value sets the Depot Asset Options - Soft linked check box. True for checked. bSoftLinked="false" # This boolean value sets the File Options - Collect asset control lists (ACL) attributes check box. True for checked. bCollectFileAcl="false" # This boolean value sets the File Options - Collect file/directory attributes check box. True for checked. bCollectFileAttributes="false" # This boolean value sets the File Options - Copy file contents check box. True for checked. bCopyFileContents="true" # This boolean value sets the Registry Options - Collect access control list (ACL) attributes check box. True for checked. bCollectRegistryAcl="false" # A collection of the above options. PACKAGE_OPTIONS="$bSoftLinked $bCollectFileAcl $bCollectFileAttributes $bCopyFileContents $bCollectRegistryAcl" # Get the template DBKey for the asset you wish to package. TEMPLATE_NAME=template1 TEMPLATE_GROUP=/template_group TEMPLATE_DBKEY=`blcli Template getDBKeyByGroupAndName $TEMPLATE_GROUP $TEMPLATE_NAME TARGET_COMPONENT="template1 (engwin2kagt1)" # Name of the software matching file. SOFTWARE_MATCH_FILE="/C/tmp/map.txt" # Now create new package. blcli BlPackage createEmptyPackage "$PACKAGE_NAME" "Package Description" "$DEPOT_GROUP_ID" PACKAGE1_DBKEY=`blcli BlPackage importAuditTargetToPackage $DEPOT_GROUP_NAME $PACKAGE_NAME $PACKAGE_OPTIONS $AUDIT1_RESULT_DBKEY $TEMPLATE_DBKEY "Owner,Group" "??OWNER??,??GROUP??" $TARGET_COMPONENT $SOFTWARE_MATCH_FILE true`