-
Couldn't load subscription status.
- Fork 79
Adding SCP support #2642
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
Adding SCP support #2642
Conversation
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.
You currently have a missing import: ImportError: No module named paramiko
.travis.yml
Outdated
| dist: precise | ||
| language: python | ||
| sudo: false | ||
| sudo: 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.
return to false
| <td width="30px"> </td> | ||
| <td> | ||
| <button type="button" class="btn btn-light" onclick="$('input[name*=\'files_to_erase\']').removeAttr('checked');">Select None</button> | ||
| <button type="button" class="btn btn-light" onclick="$('input[name*=\'files_to_erase\']').removeAttr('checked');">Unselect All</button> |
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.
This means that you have to do: git pull upstream dev
|
|
||
| def private_task(job_id): | ||
| """Complets a Qiita private task | ||
| """Completes a Qiita private task |
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.
Thanks!
Codecov Report
@@ Coverage Diff @@
## dev #2642 +/- ##
=======================================
Coverage 94.34% 94.34%
=======================================
Files 164 164
Lines 19416 19416
=======================================
Hits 18318 18318
Misses 1098 1098Continue to review full report at Codecov.
|
|
@ElDeveloper, could you take a look? Thanks! |
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.
Overall looks good, but there's a few things that we've (me and @charles-cowart) noted.
.gitignore
Outdated
| # webdis log | ||
| webdis.log | ||
|
|
||
| # test keys should generated in travis |
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.
should generated -> should be generated
qiita_ware/commands.py
Outdated
| Parameters | ||
| ---------- | ||
| URL : urlparse object |
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.
URL -> p_url
| port = p_url.port | ||
| username = p_url.username | ||
|
|
||
| if scheme == 'scp' or scheme == 'sftp': |
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.
This needs an alternative branch that raises an appropriate exception if the scheme is not supported.
qiita_ware/commands.py
Outdated
| if scheme == 'scp' or scheme == 'sftp': | ||
|
|
||
| # if port not specified, use default 22 as port | ||
| if not port: |
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.
This should probably be more explicit about the port not being specified. It should be if port is None:
qiita_ware/commands.py
Outdated
| if not port: | ||
| port = 22 | ||
|
|
||
| # step 1: both schemes requires an SSH connection |
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.
requires -> require
| url = job.parameters.values['url'] | ||
| private_key = job.parameters.values['private_key'] | ||
| try: | ||
| list_remote(url, private_key) |
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.
What is happening to the output of this function, it seems like it is not being utilized anywhere and that this job does nothing(?)
| read_file_list = list_remote('scp://localhost:'+self.remote_dir_path, | ||
| self.test_ssh_key) | ||
| remote_filename_list = [basename(f) for f in | ||
| glob(join(self.remote_dir_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.
This wildcard doesn't seem consistent with the checks, since we only allow the extensions that are described in the qiita config file. I would suggest that the expected list be hardcoded instead.
| self.assertEqual(remote_filename_list, local_filename_list) | ||
|
|
||
| def test_download_sftp(self): | ||
| """Tests remote file listing using private key and sftp""" |
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.
should be Tests remote file downloading ...
| read_file_list = list_remote('sftp://localhost:'+self.remote_dir_path, | ||
| self.test_ssh_key) | ||
| remote_filename_list = [basename(f) for f in | ||
| glob(join(self.remote_dir_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.
Same as above.
| download_remote('scp://localhost:'+self.remote_dir_path, | ||
| self.test_ssh_key, self.temp_local_dir) | ||
| remote_filename_list = [basename(f) for f in | ||
| glob(join(self.remote_dir_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.
Same as above
|
This PR has been superseded by #2660 |
Note that it doesn't support connecting with passwords and instead requires ssh keys.