Example of an export and import workflow
This is an example of a simple workflow involving multiple BMC BladeLogic deployments for handling the import/export of component templates that change over time, without having to needlessly resend the BLPackages (and their potentially large payloads) each time.
The first time you export a component template, you need to export it in its entirety. You can do this as follows:
TEMPLATE_KEY=`blcli Template getDBKeyByGroupAndName /group1 sharedTemplate`
blcli ImportExport exportObject 250 $TEMPLATE_KEY C:\tmp\export_files\sharedTemplate
After getting copies of the exported files, each of the importing systems can then import the template as follows:
Later, if the original system modifies that template, you can export the original system's template without its BLPackages:
TEMPLATE_KEY=`blcli Template getDBKeyByGroupAndName /group1 sharedTemplate`
blcli ImportExport exportObjectWithoutBlPackages 250 $TEMPLATE_KEY C:\tmp\export_files\sharedTemplate
It might be the case, however, that new BLPackages were added to the template in the time that has elapsed since its original export. In this case, those BLPackages (and only those BLPackages) should be exported individually. For example, if there was one new BLPackage added (newPkg):
PACKAGE_KEY=`blcli BlPackage getDBKeyByGroupAndName /group1 newPkg`
blcli ImportExport exportObject 28 $PACKAGE_KEY C:\tmp\export_files\newPkg
After copying all the exported files to the importing systems, the first thing you should do is import the new BLPackage:
After the new package exists, you can import the updated template (which contains no BLPackages). The automatically generated mapping file for that template will already contain the appropriate information to reference the BLPackage newPkg, provided that you imported it into the same location on the new system as it existed on the old system. If you imported it into a different location you can fix this by editing the appropriate <blpackage_mapping> section of the mapping file before importing.
To update the previously imported template, rather than create a new one, use importAndUpdateByName:
blcli Template importAndUpdateByName C:\tmp\export_files\sharedTemplate C:\tmp\export_files\sharedTemplate\mapping.xml sharedTemplate sharedTemplate /group1
This command rewrites the contents of the template sharedTemplate with the data from the imported template.
You can repeat this process each time that the sharedTemplate template is updated on the exporting system. Even if every importing system gets a copy of every version of the template, the last version of the template contains the correct information. Because importAndUpdateByName always overwrites all of the data in the template to match the current version, it does not matter what was in that template before you run the command.