2.5 Creating Bundles by Using the zman Command Line Utility

ZENworks Configuration Management allows you to create different types of bundles, such as Windows bundle, File bundle, Directive bundle, and Imaging bundle. Each bundle has its own set of data and configuration settings. Because it is complex to pass the data as arguments in the command line, the zman utility takes XML files as an input to create bundles. To use the zman command line utility to create a bundle, you must have a bundle of the same type already created through ZENworks Control Center and export it to XML. For more information on creating bundles by using ZENworks Control Center, see Section 2.0, Creating Bundles. You can use the exported XML file as a template to create bundles by using zman.

For example, you can export a File bundle already created through ZENworks Control Center into an XML file, then use it to create another File bundle with zman.

A bundle can have file content associated with it. For example, an MSI file to be installed is a file content associated with a Windows MSI Bundle.

Bundles can also have dependencies on other bundles.

Review the following sections to create a bundle by using the zman command line utility:

2.5.1 Creating a Bundle without Content or Dependency on Another Bundle

  1. Create a bundle in ZENworks Control Center.

    For example, use ZENworks Control Center to create a Web Application bundle called google, which launches the Google Web site.

  2. Export the bundle to an XML file by using the following command:

    zman bundle-export-to-file bundle_name bundle_filename.xml

    For example, export the google bundle to google.xml by using the zman bundle-export-to-file google google.xml command.

    If you want to create a new bundle with new data, continue with Step 3. If you want to create a new bundle with the same data as the google bundle, skip to Step 4.

  3. Modify the XML file according to your requirements.

    For example, change the value of <URL> from http://www.google.com to http://www.yahoo.com in the Launch URL Action section of Launch ActionSet in the XML file as shown below.

       <ns2:ActionSets>
    
            <Id>104e5d74804052eb7ddc4a2f54358d97</Id>
    
           <Type>Launch</Type>
    
            <Version>1</Version>
    
            <Modified>false</Modified>
    
            <Data>
    
                <ns1:Launch/>
    
            </Data>
    
            <Actions>
    
                <Id>2ef5c645774759e9868ba2c157301949</Id>
    
                <Type>Launch URL Action</Type>
    
                <Data>
    
                    <ns1:LaunchUrlActionData>
    
                        <URL>http://www.yahoo.com</URL>
    
                        <WaitForExit>false</WaitForExit>
    
                    </ns1:LaunchUrlActionData>
    
                </Data>
    
                <ContinueOnFailure>false</ContinueOnFailure>
    
                <Enabled>true</Enabled>
    
                <Properties />
    
            </Actions>
    
        </ns2:ActionSets>
    
  4. Create a new bundle by using the following command:

    zman bundle-create new_bundle_name bundle_xml_filename.xml

    For example, to create the yahoo bundle, enter the zman bundle-create yahoo google.xml command at the console prompt.

2.5.2 Creating a Bundle with Content and Dependency on Another Bundle

  1. Create two bundles in ZENworks Control Center.

    For example, use ZENworks Control Cener to create two MSI application bundles called officeXP and officeXPSP1. The officeXP bundle installs Microsoft Office XP through an MSI. The officeXPSP1 bundle installs the Service Pack 1 for Microsoft Office XP. In the officeXP bundle, add an Install Bundle action to install officeXPSP1.

  2. Export the bundle, which has the dependency on another bundle, to an XML file by using the following command:

    zman bundle-export-to-file bundle_name bundle_filename.xml

    This creates bundle_filename.xml and bundle_filename_ActionContentInfo.xml files.

    For example, export the officeXP bundle to officeXP.xml by using the zman bundle-export-to-file officeXP officeXP.xml command. The officeXP.xml and officeXP_ActionContentInfo.xml files are created.

    Sample xml format templates, WindowsMSIBundle.xml and ActionInfo.xml, are available at /opt/novell/zenworks/share/zman/samples/bundles on a Linux server and in "%ZENWORKS_HOME%\Novell\Zenworks\share\zman\samples\bundles on a Windows server. For more information about ActionContentInfo.xml, see Section 2.5.3, Understanding the zman Bundle XML File Format.

    If you want to create a new bundle with new data, continue with Step 3. If you want to create a new bundle with the same data as the officeXP bundle, skip to Step 4.

  3. Modify the officeXP.xml and officeXP_ActionContentInfo.xml files according to your requirements.

    For example, to create a new bundle to install ApplicationX and its support pack, do the following:

    • Change all references of officeXP.msi to ApplicationX.msi in the officeXP_ActionContentInfo.xml file.

    • Create another bundle called as ApplicationX-SP1 that installs the support pack for Application X.

    • Change the path of the dependent OfficeXPSP1 bundle to ApplicationX-SP1 in the officeXP_ActionContentInfo.xml to install both ApplicationX and its support pack.

    A sample officeXP_ActionContentInfo.xml is as follows:

    <ActionInformation>
    
       <ActionSet type="Install">
    
            <Action name="Install MSI" index="1">
    
                <Content>              
    
                    <ContentFilePath includeAllFilesinFolder="false"
    
    includeAllFilesinSubFolders="false">E:\files\ApplicationX.msi</ContentFilePath>
    
                </Content>                            
    
            </Action>
    
            <Action name="Install Bundle" index="2">
    
             <DependentBundlePath>bundlefolder/ApplicationX-SP1</DependentBundlePath>             
    
            </Action>
    
        </ActionSet>
    
        <ActionSet type="Uninstall">
    
            <Action name="Undo Install Actions" index="1">
    
                <Content>                
    
                    <ContentFilePath includeAllFilesinFolder="false" includeAllFilesinSubFolders="false">E:\files\ApplicationX.msi</ContentFilePath>
    
                </Content>
    
            </Action>
    
        </ActionSet>
    
    </ActionInformation>
    
  4. Create a bundle by using the following command:

    zman bundle-create new_bundle_name bundle_xml_filename.xml bundle_location --actioninfo bundle_name_ActionContentInfo.xml

    If you do not specify the location of the bundle creation, the bundle is created in the root folder (/Bundles) by default.

    For example, use the following command to create a bundle called ApplicationX in the root folder (/Bundles):

    zman bundle-create ApplicationX officeXP.xml --actioninfo officeXP_ActionContentInfo.xml

    You can also specify the folder in which the bundle should be created.

    For example, use the following command to create a bundle called ApplicationY in the Software folder under the root folder (/Bundles/Software):

    zman bundle-create ApplicationY officeXP.xml /Bundles/Software --actioninfo officeXP_ActionContentInfo.xml

2.5.3 Understanding the zman Bundle XML File Format

The bundle-export-to-file command serializes the bundle information, which is stored in the database, into an XML file. Each bundle contains actions that are grouped into action sets such as Install and Launch. An exported bundle XML file contains information for the bundle, such as UID, Name, Path, PrimaryType, SubType, Category, System Requirements, and information on all ActionSets and their actions. The file does not include information about assignment of the bundle to devices or users, and add-on images for the bundle.

A sample XML format template, WindowsMSIBundle.xml, is available at /opt/novell/zenworks/share/zman/samples/bundles on a Linux server and in "%ZENWORKS_HOME%\Novell\Zenworks\share\zman\samples\bundles on a Windows server.

NOTE:If the exported XML file contains extended ASCII characters, you must open it in an editor by using UTF-8 encoding instead of ANSI encoding, because ANSI encoding displays the extended ASCII characters as garbled.

When you create a bundle from the XMLfile, zman uses the information specified in the <Description>, <SubType>,<Category>, <ActionSets>, and <SysReqs> elements of the file. The values for the Name and Parent Folder are taken from the command line. For the remaining elements, the default value is used.

Follow the guidelines listed below to work with the XML file:

  • If you want to create a bundle without file content or dependency on another bundle, you need only the bundle XML file to create a bundle.

  • If you want to create a bundle with content or dependency on another bundle, you must provide an additional XML file, which contains the path of the content file or the dependent bundle, as an argument to the --actioninfo option of the bundle-create command.

    A sample XML format template, ActionInfo.xml, is available at /opt/novell/zenworks/share/zman/samples/bundles on a Linux server and in "%ZENWORKS_HOME%\Novell\Zenworks\share\zman\samples\bundles on a Windows server.

  • If you want to modify the <Data> element of actions in the exported XMLfile, ensure that the new data is correct and that it conforms to the schema. The zman utility does a minimal validation of the data and does not check for the errors in the data. Hence, the bundle might be successfully created, but with invalid data. Such a bundle fails when deployed on a managed device.

  • File content or bundle dependencies are associated with a particular action in <ActionSet>. The Action Content Information XML file should contain the path of the file to which the file content is to be associated and the index of the action in the <ActionSet>.

    For example, the MSI file to be installed when you create the Windows MSI Bundle is associated to the first Install MSI action in the Install action set of the created Windows MSI Bundle.

  • The <ActionSet> is specified by the type attribute. It should be the same as the Action Set type of the bundle XML file.

  • The <Action> element has a name attribute, which is optional, for user readability.

  • The index attribute is mandatory. It specifies the action to which the content or dependency should be associated. The index value of the first action in <ActionSet> is 1.

  • Each action can have multiple <Content> elements, each containing a <ContentFilePath> element. The <ContentFilePath> element contains the path of the file content to be associated with the Action. Ensure that the filename is the same as the filename specified in the bundle XML file in <Data> for that action.

  • Ensure that the order of the <Content> elements is in accordance with the order in the bundle XML file. For example, the Windows MSI bundle should have the MSI file in the first <Content> element, followed by <Content> elements with the path to the MST files in the order specified in <Data> for that action.

  • For creating Windows MSI bundles, you can include all the files in the folder or subfolders by setting the includeAllFilesinFolder and includeAllFilesinSubFolders attributes to True. The dependency to another bundle can be specified by giving the bundle path as a value of the <DependentBundlePath> element. The path of the bundle specified should be relative to /Bundles as shown below.

    <ActionSet type="Install">
    
    <Action name="Install MSI" index="1">
    
    <Content>
    
    <ContentFilePath includeAllFilesinFolder="false" includeAllFilesinSubFolders="false">E:\files\ApplicationX.msi</ContentFilePath>
    
    </Content>
    
    <Content>
    
    <ContentFilePath includeAllFilesinFolder="false"
    
    includeAllFilesinSubFolders="false">E:\files\ApplicationX_MST1.mst</ContentFilePath>
    
    </Content>
    
    </Action>
    
    <Action name="Install Bundle" index="2">
    
    <DependentBundlePath>bundlefolder/ApplicationX-SP1</DependentBundlePath>
    
    </Action>
    
    </ActionSet>
    
  • To get the UID of an object, use the object-get-GUID command. You must manually edit the object UIDs in the bundle XML file in the following scenarios:

    • In the Bundle Installed system requirement, the path and the UID of the bundle must be changed in the <BundleInstalledReq> element under the <SysReqs> element.

    • In the Imaging bundle, the UID of the server containing the .img file must be manually changed in the ZENworks Image and Multicast Image Set actions. Also, the UID of the linked application bundle must be manually changed in the Linked Application Bundle and Multicast Image Set actions. Ensure that the linked bundle already has an add-on image that was created manually, because it is not automatically created when the bundle is linked to the image bundle.