kolfild26 opened a new pull request, #27370: URL: https://github.com/apache/airflow/pull/27370
Based on https://github.com/apache/airflow/discussions/23788 **Motivation.** Provide the ability to analyze the SSH tasks exit code in order to build a dag logic based on these codes. Now, only `echo` output goes to XCOM's return_value key. And If case of failure nothing being passed to return_value. So in a dag we don't know what specific code is returned. **What's done:** In [SSHOperator](https://github.com/apache/airflow/blob/main/airflow/providers/ssh/operators/ssh.py#L36), add XCOM key **ssh_exit**. Task succeeded - ssh_exit set to 0. `echo` stuff still passed to return_value. Task failed - ssh_exit stores the code which was retrived from the ssh session. ``` SSHOperator( command="pwd", dag=dag) SSHOperator( command="pwd && exit 123", dag=dag) ```  **P.S.** I could imagine the alternative possible scenario - not to introduce a new XCOM key and just replace the return_value content, i.e. skip all other text output and just pass the ssh exit code there. But my first approach does not reduce the functionality and the second one does. So I prefered the first. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
