Search code examples
shellhadoophdfsoozieoozie-coordinator

Oozie email action attachment


I am trying to get an hdfs location and provide it as email attachment to oozie email action. My hdfs location can be found only using a shell action. Now how can I pass the output of my shell action, which would be the hdfs path to my oozie email action. Can this be achieved using oozie?

<workflow-app name="[WF-DEF-NAME]" xmlns="uri:oozie:workflow:0.1">
  ...
  <action name="[NODE-NAME]">
    <email xmlns="uri:oozie:email-action:0.2">
        <to>[COMMA-SEPARATED-TO-ADDRESSES]</to>
        <subject>[SUBJECT]</subject>
        <body>[BODY]</body>
        <content_type>[CONTENT-TYPE]</content_type> 
        **<attachment>[COMMA-SEPARATED-HDFS-FILE-PATHS]</attachment>** 
    </email>
    <ok to="[NODE-NAME]"/>
    <error to="[NODE-NAME]"/>
  </action>
  ...
</workflow-app>

Solution

  • See my comment, but for others checking this issue, the answer is: Capture the output of the shell action

    <capture-output/>
    

    and pass it as a param for the email action

    <attachment>${wf:actionData('shell_action')['path']}</attachment>
    

    For detail check the link in my comment.