This message was posted by a user wishing to remain anonymous
Does anyone know whether it's possible to commit configuration using a Python based commit script, using PyEZ with set commands?
LLMs are hallucinating telling me it's possible, but I'm struggling to find resources pointing to PyEZ's usage on box, despite it being outlined as a supported library https://www.juniper.net/documentation/us/en/software/junos/automation-scripting/topics/concept/junos-python-modules-on-device.html and with most examples I can find point to jcs.emit_change() where only XML based changes are possible.
In essence, I wish to do the below, where change is any valid set command, but I seem to hit an issue that I assume is essentially related to the commit script itself locking the database, and then an attempt made within the commit script to lock the database.
Should I be trying to use an ephemeral database instead, or taking another approach? Does anyone have a working, on-box, pyez example?
Thanks in advance.
with Device() as dev:
with Config(dev, mode='private') as cfg:
cfg.load(change,format="set", merge=True)
cfg.commit(comment="pyez load attempt")