Michalis Kongtongk created OOZIE-1974:
-----------------------------------------

             Summary: SSH Action doesn't handle compound commands eg: cmd1 && 
cmd2 and stuck in [PREP] stage
                 Key: OOZIE-1974
                 URL: https://issues.apache.org/jira/browse/OOZIE-1974
             Project: Oozie
          Issue Type: Bug
          Components: action
    Affects Versions: trunk
            Reporter: Michalis Kongtongk


example WF that will fail:
{code}
<workflow-app name="SSH_COMPOUND_COMMAND" xmlns="uri:oozie:workflow:0.4"> 
<start to="hello"/> 
<action name="hello" cred=""> 
<ssh xmlns="uri:oozie:ssh-action:0.1"> 
<host>[email protected]</host> 
<command>kinit</command> 
<args>[email protected]</args> 
<args>-k</args> 
<args>-t</args> 
<args>/home/oozie-user/oozie.keytab</args> 
<args>&amp;&amp;</args> 
<args>hdfs</args> 
<args>dfs</args> 
<args>-put</args> 
<args>/tmp/random-file.txt</args> 
<args>/tmp/random-file.txt</args> 
</ssh> 
<ok to="end"/> 
<error to="kill"/> 
</action> 
<kill name="kill"> 
<message>Action failed, error 
message[${wf:errorMessage(wf:lastErrorNode())}]</message> 
</kill> 
<end name="end"/> 
</workflow-app>
{code}

Workaround is to execute the compound command in subshell eg: $(cmd1 && cmd2) 
{code}
<workflow-app name="SSH_COMPOUND_COMMAND" xmlns="uri:oozie:workflow:0.4"> 
<start to="hello"/> 
<action name="hello" cred=""> 
<ssh xmlns="uri:oozie:ssh-action:0.1"> 
<host>[email protected]</host> 
<command>$(kinit</command> 
<args>[email protected]</args> 
<args>-k</args> 
<args>-t</args> 
<args>/home/oozie-user/oozie.keytab</args> 
<args>&amp;&amp;</args> 
<args>hdfs</args> 
<args>dfs</args> 
<args>-put</args> 
<args>/tmp/random-file.txt</args> 
<args>/tmp/random-file.txt</args> 
<args>)</args> 
</ssh> 
<ok to="end"/> 
<error to="kill"/> 
</action> 
<kill name="kill"> 
<message>Action failed, error 
message[${wf:errorMessage(wf:lastErrorNode())}]</message> 
</kill> 
<end name="end"/> 
</workflow-app>
{code}

Stack trace "org.apache.oozie.command.CommandException: E0800: Action it is not 
running its in [PREP] state,"
{code}
2014-08-05 23:29:49,721 INFO org.apache.oozie.action.ssh.SshActionExecutor: 
SERVER[192-168-88-213.lunix.lan] USER[mko] GROUP[-] TOKEN[] APP[Ssh-copy] 
JOB[0000008-140805224842389-oozie-oozi-W] 
ACTION[0000008-140805224842389-oozie-oozi-W@Ssh] start() begins 
2014-08-05 23:29:49,723 INFO org.apache.oozie.action.ssh.SshActionExecutor: 
SERVER[192-168-88-213.lunix.lan] USER[mko] GROUP[-] TOKEN[] APP[Ssh-copy] 
JOB[0000008-140805224842389-oozie-oozi-W] 
ACTION[0000008-140805224842389-oozie-oozi-W@Ssh] Attempting to copy ssh base 
scripts to remote host [[email protected]] 
2014-08-05 23:29:52,691 INFO org.apache.oozie.servlet.CallbackServlet: 
SERVER[192-168-88-213.lunix.lan] USER[-] GROUP[-] TOKEN[-] APP[-] 
JOB[0000008-140805224842389-oozie-oozi-W] 
ACTION[0000008-140805224842389-oozie-oozi-W@Ssh] callback for action 
[0000008-140805224842389-oozie-oozi-W@Ssh] 
2014-08-05 23:29:52,714 ERROR 
org.apache.oozie.command.wf.CompletedActionXCommand: 
SERVER[192-168-88-213.lunix.lan] USER[-] GROUP[-] TOKEN[] APP[-] 
JOB[0000008-140805224842389-oozie-oozi-W] 
ACTION[0000008-140805224842389-oozie-oozi-W@Ssh] XException, 
org.apache.oozie.command.CommandException: E0800: Action it is not running its 
in [PREP] state, action [0000008-140805224842389-oozie-oozi-W@Ssh] 
at 
org.apache.oozie.command.wf.CompletedActionXCommand.eagerVerifyPrecondition(CompletedActionXCommand.java:77)
 
at org.apache.oozie.command.XCommand.call(XCommand.java:251) 
at 
org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:174)
 
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
at java.lang.Thread.run(Thread.java:662) 
2014-08-05 23:29:52,714 WARN 
org.apache.oozie.service.CallableQueueService$CallableWrapper: 
SERVER[192-168-88-213.lunix.lan] USER[-] GROUP[-] TOKEN[-] APP[-] JOB[-] 
ACTION[-] exception callable [callback], E0800: Action it is not running its in 
[PREP] state, action [0000008-140805224842389-oozie-oozi-W@Ssh] 
org.apache.oozie.command.CommandException: E0800: Action it is not running its 
in [PREP] state, action [0000008-140805224842389-oozie-oozi-W@Ssh] 
at 
org.apache.oozie.command.wf.CompletedActionXCommand.eagerVerifyPrecondition(CompletedActionXCommand.java:77)
 
at org.apache.oozie.command.XCommand.call(XCommand.java:251) 
at 
org.apache.oozie.service.CallableQueueService$CallableWrapper.run(CallableQueueService.java:174)
 
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
at java.lang.Thread.run(Thread.java:662) 

2014-08-05 23:29:57,262 INFO org.apache.oozie.action.ssh.SshActionExecutor: 
SERVER[192-168-88-213.lunix.lan] USER[mko] GROUP[-] TOKEN[] APP[Ssh-copy] 
JOB[0000008-140805224842389-oozie-oozi-W] 
ACTION[0000008-140805224842389-oozie-oozi-W@Ssh] start() ends

{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to