Automation

last person joined: 13 hours ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Can a script modify only candidate config and not commit?

    Posted 06-14-2013 05:25

    Hi All

     

    Is there a way to change Junos candidate config with commit (or maybe op) script and

    not commit it? This could be a way to check what the script is up to before doing

    a real commit.



  • 2.  RE: Can a script modify only candidate config and not commit?
    Best Answer

    Posted 06-14-2013 11:04

    Commit scripts are invoked as part of the commit process. They could always fail the commit with an error, but I don't think that is the approach you would want. Op scripts and event scripts could modify the configuration and not commit it, if that really is the behavior you're looking for. It would be the same as if a user went into config mode, made changes, and then left those changes uncommitted. To do this, just use the <load-configuration> RPC rather than the jcs:load-configuration template.

     

    However, I'd advise against doing this. Leaving uncommitted changes in the candidate configuration blocks other users/scripts from using exclusive or private configuration mode (which are safer than normal configuration mode) and it also means that someone else might log into config mode, make changes, and commit without noticing that other pending configuration changes are waiting to be made.



  • 3.  RE: Can a script modify only candidate config and not commit?

    Posted 06-14-2013 11:31

    Thanks Curtis,

     

    That was actually a question from my student. I agree this is not a thing that should

    be recommended, but it is good that we have this option as well.



  • 4.  RE: Can a script modify only candidate config and not commit?

    Posted 09-10-2013 11:50

    If you're looking to debug the script, use "juise" (available from github.com/Juniper/juise), which will run the commit script with data fetched from the device, report errors and warnings, upload any changes and transient changes back to a "private" config on the device, and then fetch a "show  | compare" ( or "show | compare | display set") to show you what would have changed.  Also does a "commit check" on those changes.

     

    Thanks,

     Phil