Open MemphisMeng opened 1 year ago
Do I see it right that you machine does not have a ~/.ssh/id_rsa
file and SSH client fail on this instead of directly making a fallback to provided user/password credentials?
If the problem resolved as workaround if you create an empty ~/.ssh/id_rsa
on your system?
Bug then also might be within paramiko, or do you think Airflow should implement a workaround for such failure?
@MemphisMeng I tried to reproduce this and in my case ~
is correctly replaced with user home dir by expanduser
here: https://github.com/paramiko/paramiko/blob/66117732de6de03914308f9a21b05b50a781d13c/paramiko/client.py#L774
So I compared your stack trace with mine and it seems that your code reached https://github.com/paramiko/paramiko/blob/66117732de6de03914308f9a21b05b50a781d13c/paramiko/client.py#L730 which is only possible if you provided key_file
in your connection params. Your code sample doesn't mention it - is it possible that some details are missing in your sample?
I'm using apache-airflow-providers-sftp==4.2.4 I've just tried to move to SFTPHook instead of deprecated SSHHook and ran into this problem Rolling back to ssh_hook=SSHHook(...) in SFTPOperator "fixed" this. I hope this helps you before proper fix is released
Marked it as good first issue - maybe someone will be able to reproduce and fix it.
@Bisk1 Probably I did miss something, can you tell me what key type is yours?
Do I see it right that you machine does not have a
~/.ssh/id_rsa
file and SSH client fail on this instead of directly making a fallback to provided user/password credentials? If the problem resolved as workaround if you create an empty~/.ssh/id_rsa
on your system? Bug then also might be within paramiko, or do you think Airflow should implement a workaround for such failure?
I've had ~/.ssh/id_rsa
in my system and it's unlikely for me to empty it. I'm sure this is a built-in bug in paramiko, given my experience and contributions to Airflow, I can't answer your second question.
@Bisk1 Probably I did miss something, can you tell me what key type is yours?
I didn't provide this param at all when trying to reproduce. I meant that if would be helpful if you could update your example with relevant details.
@eladkal feel free to assign this to me, if no one is checking.
Was not able to reproduce either, @MemphisMeng could you please provide more details.
Apache Airflow version
Other Airflow 2 version (please specify below)
What happened
I tried to set up a task that uploads files to an endpoint via SFTP using SFTP Operator from one of Airflow providers, sftp. My code is like:
It failed all the time due to the built-in intelligibility of Python when the file path includes "~" as the abbreviation for the MacOS user path.
This is my detail traceback:
What you think should happen instead
My guess is that should we modify somewhere in the codebase to always let paramiko receive the complete user path instead of "~", it would be resolved.
How to reproduce
Prepare a working SFTP portal, and the credentials including username, password and port that are required to connecting it. Set up a task like I did in the previous part. Trigger the DAG that includes it.
Operating System
macOS 14.0 (23A344)
Versions of Apache Airflow Providers
apache-airflow-providers-celery==3.3.4 apache-airflow-providers-common-sql==1.5.2 apache-airflow-providers-ftp==3.4.2 apache-airflow-providers-http==4.4.2 apache-airflow-providers-imap==3.2.2 apache-airflow-providers-sftp==4.7.0 apache-airflow-providers-sqlite==3.4.2 apache-airflow-providers-ssh==3.8.0
Deployment
Virtualenv installation
Deployment details
No response
Anything else
No response
Are you willing to submit PR?
Code of Conduct