N1 Service Provisioning System 4.1 User's Guide

Using Scripts in Install-to-Install Comparisons

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 HTML user 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/generate and cleanup blocks for the target host by un-selecting the appropriate boxes.

You can enter scripts such as these into the fields:

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


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

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


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