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.xsladds thehost-namestatement to the configuration, and scriptB.xslemits an error message when thehost-namestatement is included. However, on a subsequent commit, scriptB.xslevaluates the new configuration with thehost-namestatement included, and this time scriptB.xslcauses the commit operation to fail. To make sure that persistent changes generated by commit scripts conform to your custom rules, you must issue twocommitcommands.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.xslare loaded before the changes emitted by scriptB.xsl. If scriptA.xslincludes thehost-namestatement with therouter1option, and scriptB.xslincludes thehost-namestatement with therouter2option, the resulting configuration includeshost-name router2, because the change emitted by scriptB.xslis loaded after, and therefore overrides, the change emitted by scriptA.xsl.[edit system scripts commit]user@host#showfile 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.xsladds thehost-namestatement and scriptB.xsldeletes thehost-namestatement, the following steps happen on each commit.<change><host-name/></change><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-namedelete="delete"/> #Deletes the statement.</configuration></load-configuration>The
host-namestatement is added to the configuration and then immediately deleted. After the commit operation is final, thehost-namestatement does not appear in the configuration. Each script sees the exact same input, but the output is loaded sequentially. Neither scriptA.xslnor scriptB.xslsees thehost-namestatement in the input candidate configuration, but if scriptA.xsladds the statement and scriptB.xsldeletes the statement, the software performs each set of instructions in turn.