[Contents] [Prev] [Next] [Index] [Report an Error]


Using Multiple Commit Scripts

If you are using multiple commit scripts, the XML-formatted candidate configuration is passed to all scripts, one by one. If a script modifies the candidate configuration, the modified configuration is not passed on to the next script for evaluation. All commit scripts inspect the same candidate configuration. This means conflicts between scripts might not be resolved when the scripts are first applied to the configuration. For example, a commit operation does not fail if script A.xsl adds the host-name statement to the configuration, and script B.xsl emits an error message when the host-name statement is included. However, on a subsequent commit, script B.xsl evaluates the new configuration with the host-name statement included, and this time script B.xsl causes the commit operation to fail. To make sure that persistent changes generated by commit scripts conform to your custom rules, you must issue two commit commands.

On the other hand, script-generated configuration changes are loaded sequentially according to the order of the scripts in the configuration. In the following example, the changes emitted by script A.xsl are loaded before the changes emitted by script B.xsl. If script A.xsl includes the host-name statement with the router1 option, and script B.xsl includes the host-name statement with the router2 option, the resulting configuration includes host-name router2, because the change emitted by script B.xsl is loaded after, and therefore overrides, the change emitted by script A.xsl.

[edit system scripts commit]
user@host# show
file A.xsl; # Configuration changes emitted by this script are loaded first.
file B.xsl; # Configuration changes emitted by this script are loaded second.

If script A.xsl adds the host-name statement and script B.xsl deletes the host-name statement, the following steps happen on each commit.

Script A.xsl emits:

<change>
    <host-name/>
</change>

Script B.xsl emits:

<change>
    <host-name delete="delete"/>
</change>

The management process (mgd) loads these changes as follows:

<load-configuration>
    <configuration>
        <host-name/> # Adds the statement to the configuration.
        <host-name delete="delete"/> # Deletes the statement.
    </configuration>
</load-configuration>

The host-name statement is added to the configuration and then immediately deleted. After the commit operation is final, the host-name statement does not appear in the configuration. Each script sees the exact same input, but the output is loaded sequentially. Neither script A.xsl nor script B.xsl sees the host-name statement in the input candidate configuration, but if script A.xsl adds the statement and script B.xsl deletes the statement, the software performs each set of instructions in turn.



[Contents] [Prev] [Next] [Index] [Report an Error]