user3316066
user3316066

Reputation: 11

How to pass configuration to Oozie email action

I have a simple oozie workflow that performs a pig actions and sends an email in case it fails.

The email action node:

<action name="send_email_on_error">
        <email xmlns="uri:oozie:email-action:0.1">
            <job-xml>oozie-site.xml</job-xml>
            <to>[email protected]</to>
            <subject>Oozie Error</subject>
            <body>error message[${wf:errorMessage(wf:lastErrorNode())}]</body>
        </email>
        <ok to="fail"/>
        <error to="fail"/>
    </action>

I created a oozie-site.xml file and added to it the following properties:

<property>
        <name>oozie.email.smtp.host</name>
        <value>smtp.gmail.com</value>
    </property>
    <property>
        <name>oozie.email.smtp.port</name>
        <value>587</value>
    </property>
    <property>
        <name>oozie.email.from.address</name>
        <value>[email protected]</value>
    </property>

Trying to deploy the job I get an error:

E0701: XML schema error, cvc-complex-type.2.4.a: Invalid content was found starting with element 'job-xml'. One of '{"uri:oozie:email-action:0.1":to}' is expected.

How do I pass this necessary configuration to Oozie?

Upvotes: 0

Views: 5315

Answers (2)

Nishu Tayal
Nishu Tayal

Reputation: 20860

oozie-site.xml is loaded by default,so need to include it explicitly. Remove the below line from action:

<job-xml>oozie-site.xml</job-xml>

It should work now.

Upvotes: 0

Stefan Papp
Stefan Papp

Reputation: 2255

The job-xml is attribute is wrong. Remove it and it shall work fine. The configuration should be read out automatically.

Upvotes: 0

Related Questions