I am trying to to write an on-box commit script via python which should stop the commit in case certain part of the configuration is changed - for example if somebody changed interface lo0 in any way, the commit should fail. I know there is the Python object Junos_Configuration which contains the candidate configuration, but there I can't check what exactly will be changed after the commit. Is there some other object which contains something like the result of show | compare which I could check? Or is there some other way to achieve this with Python commit script?
Have you tried pdiff() method to compare the previously and the candidate configuration? I´m not sure, but I probably would try use it before loading new configuration and compare if there is something new in the candidate configuration before starting changes.