Reply

broker->script->run not working (PERL)

csi-net
Techie
Posts: 14
2650     0

Hello,

I'd like to run netmri CSS script from external PERL script and get the output file that I'm generatinq with this script.

(connection with netmri appliance work because I'm able to use other API and get correct output from them).

The script run on netmri but I get the below error and I'm not able to get access to remote files generated by the script ot the Jobid.

 

here the PERL script:

 

 

########### PERL script ##############

 

my $script = $client->broker->script->run({
name => 'testscript',
wait => 60,
device_ids => 83,
})->{JobID};

print "JobID :", $script, "\n";

 

#####################################

 

But as I run the script I get the folowing error

 

SERVER general/unexpected-error SQL::Error https://x.x.x.x/api/3.1/scripts/run.json at ./testnetmri4.pl line 48

line 48 is: my $script = $client->broker->script->run

 

 

thank you in advance ..

 

Re: broker->script->run not working (PERL)

csi-net
Techie
Posts: 14
2651     0

 

I get aroud the issue I used "broker->script->run" without input "wait" this will return me the Jobid.

I'll use Jobid with broker->job->search to get the status and as it is OK I'll get the filesname and file content with

broker->job->job_files.

 

 

Re: broker->script->run not working (PERL)

Expert
Posts: 169
2651     0

Well, after much head-banging, I found this post and removed "wait" and wha-la, it returns the job id.  

 

Sif / Ingmar - do you think you could get this fixed?  It fails in the API, it would be nice to have the wait param work as documented and return the payload Smiley Happy

 

# This one will fail - 
https://mynetmri/api/3.2/scripts/run?name=Ad%20Hoc%20Command%20Batch&device_ids=1989994802611670135&$commands_to_be_executed=show%20ver&credential_mode=manual&name=NW%20-%20Ad%20Hoc%20Command%20Batch&username=mynetmri&password=mypass&wait=600

# This one will work - 
https://mynetmri/api/3.2/scripts/run?name=Ad%20Hoc%20Command%20Batch&device_ids=1989994802611670135&$commands_to_be_executed=show%20ver&credential_mode=manual&name=NW%20-%20Ad%20Hoc%20Command%20Batch&username=mynetmri&password=mypass

Re: broker->script->run not working (PERL)

Expert
Posts: 169
2651     0

...and I did try in a script and passed the 'wait':'600' (as a string rather than an integer), but still get requests.exceptions.HTTPError: {u'message': u'SQL::Error', u'error': u'general/unexpected-error'}

Showing results for 
Search instead for 
Do you mean 

Recommended for You