-
-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First attempt to implement reading via SSH/SCP #44
Conversation
There seems to be some bug in travis, based on the log there is problem with packages installation via pip. Second question is that if we can assume for reading from ssh that everybody has his/her public key in |
I'd say, implement what you need, cleanly. If someone needs more functionality, they can open a new PR to justify that extra complexity. I don't understand the question with It may also make sense to pass additional options to SSH, so that it doesn't trigger interactive prompts ("known host checking" etc). But it's a slippery slope, I wouldn't want CC @gojomo opinion? |
I've added that smart_open will not check for known hosts. With And again output from unit tests on Travis is kind of weird. Is there some problem with travis? |
|
||
def __iter__(self): | ||
ssh = subprocess.Popen("ssh -o StrictHostKeyChecking=no " + self.parsed_uri.netloc + " 'cat " + self.parsed_uri.uri_path + "'", | ||
stdout=subprocess.PIPE, shell=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choices on this line introduce risks that, while perhaps justified in many/most usage situations, should be clearly documented and perhaps require a user's explicit opt-in. (1) Users should know (perhaps by choosing a non-default option) that there's no host-key-checking; (2) composing a locally- and remotely- shelled execution string from the URI parts could introduce arbitrary execution risks at both endpoints, so extra care must be taken where such paths originate.
@tmylk is working on fixing the travis tests. Regarding SSH options -- let's make that a configurable list, via an object attribute (e.g. Regarding the documentation, I agree with @gojomo that we should feature prominently the fact that Also I'm not sure the |
self.parsed_uri = parsed_uri | ||
|
||
def __iter__(self): | ||
ssh = subprocess.Popen("ssh -o StrictHostKeyChecking=no " + self.parsed_uri.netloc + " 'cat " + self.parsed_uri.uri_path + "'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better (more robust) to pass a list of arguments to Popen
ctr, rather than a single hand-assembled string.
Here's a pure-python (no shell) solution using Parimiko (the low level lib used by fabric) It also has the side-benefit of maintaining connections so you only have to suffer through setup time once per connection :) |
@val314159 Solution using Parimiko looks better. |
Goal of this PR is to add the functionality of reading files via SSH/SCP from remote machines part of what was discussed in the issue #36 .
PLEASE DO NOT MERGE YET:
TODO:
implement testsWhat should be discussed: