Created 09-15-2020 05:07 AM
I have a shell action node that is able to send notifications to a chat application and can be used as a transition route if another action node in the workflow fails. What I'd like to be able to do, is use wf:user() and wf:lastErrorNode() in that notification.
My idea was to pass these values to my shell script as arguments, but when I place 'wf:X()' as the argument to my shell action node, it doesn't resolve to anything and just gives me the raw string as the argument.
Is there a way to use these in a shell action node?
Created 09-17-2020 01:17 AM
Hi Alex,
I've resolved the issue. I had been using the wf:X() in the wrong place. Initially I had added an argument for the shell action like ${user} and then set $wf:user() as the value of that argument when submitting the workflow.
I replaced ${user} with the Expression Language Function and the value was resolved automatically and when submitting the workflow I wasn't asked to provide a value for the argument 🙂
Created 09-15-2020 10:43 AM
Hi James,
Could you share your XML action script for that SSH action?
In general, the following example shows how to pass arguments to your shell (from Oozie docs😞
<workflow-app name="sample-wf" xmlns="uri:oozie:workflow:0.1">
...
<action name="myssjob">
<ssh>
<host>foo@bar.com<host>
<command>YOURCOMMAND</command>
<args>${wf:user()}</args>
<args>${wf:lastErrorNode()}</args>
</ssh>
<ok to="myotherjob"/>
<error to="errorcleanup"/>
</action>
...
</workflow-app>
Note the ${} syntax of the parameter. If this helps, please accept this as a solution.
Regards,
Alex
Created 09-16-2020 12:21 PM
If you are doing this through Hue, please post the generated XML once you submit the job.
Created 09-17-2020 01:17 AM
Hi Alex,
I've resolved the issue. I had been using the wf:X() in the wrong place. Initially I had added an argument for the shell action like ${user} and then set $wf:user() as the value of that argument when submitting the workflow.
I replaced ${user} with the Expression Language Function and the value was resolved automatically and when submitting the workflow I wasn't asked to provide a value for the argument 🙂