darkag opened a new issue, #46668:
URL: https://github.com/apache/airflow/issues/46668

   ### Apache Airflow version
   
   2.10.5
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   When using winrm hook, the following code fail
   `hook = WinRMHook(ssh_conn_id="conn")
    _, stdout_buffer, _ = hook.run(command='echo test')
    _, stdout_buffer, _ = hook.run(command='echo test2')
   `
   this is due to an inconsistence between the get_conn and run functions : 
   - get_conn : if clientid is not define open a new shell and store the 
clientid, else return the clientid
   - run : call get_conn, launch the command and close the shell but not set 
clientid to null, so the next call of run will try to launch command on a 
closed shell
   
   ### What you think should happen instead?
   
   we should be able to call run multiple times without having to create a new 
hook.
   run should at least set clientid to null after closing shell, but I think 
that it would be better if get_conn doesn't open a shell since it will create a 
process on distant server that may never close if you forget to explicitly 
close it. 
   
   ### How to reproduce
   
   run the above code in a task
   
   ### Operating System
   
   debian
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-microsoft-winrm==3.6.1
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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]

Reply via email to