Uploaded image for project: 'Oozie'
  1. Oozie
  2. OOZIE-1974

SSH Action doesn't handle compound commands eg: cmd1 && cmd2 and stuck in [PREP] stage

Add voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • trunk
    • None
    • action
    • None

    Description

      example WF that will fail:

      <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>oozie-user@somedomain.com</host> 
      <command>kinit</command> 
      <args>oozie-user@SOMEDOMAIN.COM</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>
      

      Workaround is to execute the compound command in subshell eg: $(cmd1 && cmd2)

      <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>oozie-user@somedomain.com</host> 
      <command>$(kinit</command> 
      <args>oozie-user@SOMEDOMAIN.COM</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>
      

      Stack trace "org.apache.oozie.command.CommandException: E0800: Action it is not running its in [PREP] state,"

      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 [mko@192-168-88-213.lunix.lan] 
      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
      
      

      Attachments

        1. OOZIE-1974.patch
          6 kB
          Mate Juhasz

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            matijhs Mate Juhasz
            michalisk Michalis Kongtongk

            Dates

              Created:
              Updated:

              Slack

                Issue deployment