Junos Automation (Scripting)
Junos Automation (Scripting)

Op Script from URL fails when running as event-option

3 weeks ago

We have a script we can run manually by calling the "op url exampleurl.py". It downloads from Github and processes the script without issue. When we put this script into an event-option we recieve the following error in the op script logs:


Nov 18 17:33:34: Traceback (most recent call last): 
Nov 18 17:33:34:   File "/var/db/scripts/event/script.py", line 390, in
Nov 18 17:33:34: main()
Nov 18 17:33:34:   File "/var/db/scripts/event/script.py", line 375, in main
Nov 18 17:33:34: dev.open()
Nov 18 17:33:34:   File "../../../../../../../src/dist/python-add-ons/junos-eznc/lib/jnpr/junos/device.py", line 1237, in open
Nov 18 17:33:34: jnpr.junos.exception
Nov 18 17:33:34: .
Nov 18 17:33:34: ConnectError
Nov 18 17:33:34: : 
Nov 18 17:33:34: ConnectError(host: None, msg: user "nobody" does not have access privileges.)
Nov 18 17:33:34 event script failed: /var/db/scripts/event/script.py


The event option syntax we are using is the following:

generate-event {
RUNSCRIPT time-interval 300;
policy Script {
then {
execute-commands {
commands {
"op url https://someurl@script.py";
user-name user1;


If we manually download the script and run it as an event-option event-script and specifically write in the configuration to run the event-script as a certain user then it works just fine. We are trying to however be able to run this script from the URL with the event-option method so we can update the script without the need to download it back to the device.


The issue appears to be with the way the op script is called where it runs as a generic user and group nobody when it's run as an event-policy action.


Has anyone had any luck with calling a script that way in an event-option or possibly a work around to get this to work that way?  

Junos Automation (Scripting)
Accepted by topic author benspace
3 weeks ago

Re: Op Script from URL fails when running as event-option

3 weeks ago

No idea what type of code in your script but might be related on this > https://prsearch.juniper.net/InfoCenter/index?page=prcontent&id=PR1445917 ?

If this worked for you please flag my post as an "Accepted Solution" so others can benefit.