int32bit / mistral-actions

A simple tool to discover and manage custom actions for OpenStack Mistral
https://github.com/int32bit/mistral-actions
MIT License
15 stars 2 forks source link

shell command not executing. #4

Open aashika0929 opened 6 years ago

aashika0929 commented 6 years ago

I am trying to execute a shell command using int32bit.system.exec action. The command i am trying to execute is 'sh sample.sh' where sample.sh is an external script file which I want to trigger. But I am running into the following error.

Failure caused by error in tasks: task1

task1 [task_ex_id=49641f56-009a-4301-a8e5-eabf208346ff] -> Failed to run action [action_ex_id=4ae1fa6d-0098-4c82-9c4f-5645106eb119, action_cls='<class 'mistral.actions.action_factory.Exec'>', attributes='{}', params='{u'cmd': u'sh sample.sh'}'] Command '['sh', 'sample.sh']' returned non-zero exit status 127 [action_ex_id=4ae1fa6d-0098-4c82-9c4f-5645106eb119, idx=0]: Failed to run action [action_ex_id=4ae1fa6d-0098-4c82-9c4f-5645106eb119, action_cls='<class 'mistral.actions.action_factory.Exec'>', attributes='{}', params='{u'cmd': u'sh sample.sh'}'] Command '['sh', 'sample.sh']' returned non-zero exit status 127

Pls help.

int32bit commented 6 years ago

I guess the script has been called by mistral-executor but unluckily returned non-zero, could you mind run this script on terminal or use 'mistral run-action' to trace the error and get more messages?

aashika0929 commented 6 years ago

Hi Team,

when I try to execute mistral run-action int32bit.system.exec '{"cmd":"sh sample.sh"}' I am getting the below error.

{"result": "Failed to run action [action_ex_id=None, action_cls='<class 'mistral.actions.action_factory.Exec'>', attributes='{}', params='{u'cmd': u'sh sample.sh'}']\n Command '['sh', 'sample.sh']' returned non-zero exit status 127"}

But if I run the command 'sh sample.sh' in the terminal it's working fine. Help me out.

int32bit commented 6 years ago

Maybe you need copy this script to all your executor nodes and ensure has executable permissions. In addition, you should use the absolute path rather than relative path, or the executor may can't find your script.