LUA- action.command doesn't work
search cancel

LUA- action.command doesn't work

book

Article ID: 250055

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

My understanding of the action.command function in lua is that it will execute what you parse on the command line.

I actually want to kick off a python script but can't even run a batch script, it just comes back with return code 1.

It works for a command like dir or ipconfig but that is not much use.

Is this working as designed? or is it a bug or is there another way to do this?

this is the lua...

command="python hello.py"
print(command)
out, rc = action.command(command)

print("no of return lines ="..#out)
print("action command return code ="..rc)
for key,out_table in pairs(out) do
  print(out[key])
end

Environment

UIM 20.4

Resolution

Both the python and the script need to be fully qualified with the path

for example..

command="C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python39\\python E:\\Nimsoft\\probes\\service\\nas\\scripts\\send_nrdp.py -u " .. nrdp_url .. " -t " ..nrdp_token .. " -H "..hostname.." -S " .. status .. " -o " ..message

out, rc = action.command(command)