Sun N1 Service Provisioning System 5.1 Operation and Provisioning Guide

Using Scripts in Install to Install Comparisons

If the components you are comparing include resources that are stored in a package, a database, or an archive such as a ZIP file, you can use scripts to export or transform the resources before the comparison occurs. Use the execNative step to direct the provisioning software to perform native commands such as unzipping or exporting file contents.

You can run any native command within the prepare and cleanup blocks. A common usage of these blocks before and after a comparison is to extract the files from a compressed archive and output them to a specified output file, then delete that file during the cleanup.

Note –

Unlike the execNative contained in a plan or component, this execNative instance must be contained within either a prepare or a cleanup block, and cannot make use of any variable substitutions.

When you are performing an Install to Install comparison using the browser interface, you can select a checkbox labeled Include Temporary Files Generated By Scripts During Comparison. When you select this option, the page refreshes and provides two fields into which you can enter the prepare and cleanup blocks.

You can also specify alternate prepare and cleanup blocks for the comparison host by deselecting the appropriate boxes.

For more information about execNative, see Chapter 2, Shared Schema Used by Components and Simple Plans, in Sun N1 Service Provisioning System 5.1 XML Schema Reference Guide.

Example 2–1 A prepare Block for an Install to Install Comparison

This prepare block specifies the output file for the result of the execNative. The execNative lists the contents of the /tmp directory.

  <execNative outputFile="file.txt" dir="temp">
    <exec cmd="ls">
      <arg value="-l"></arg>
      <arg value="/tmp"></arg>

Example 2–2 A cleanup Block for an Install to Install Comparison

This cleanup block then removes the output file, file.txt, from the /temp directory.

  <execNative  dir="/temp/">
    <exec cmd="rm">
      <arg value="-rf"></arg>
      <arg value="file.txt"></arg>