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
sshrun: Provide all expected GIT_SSH_COMMAND parameters #3616
Conversation
Add the argument names to the debug message to make it easier to associate a value with a name. This is useful as is but will be particularly helpful when the upcoming commits add new arguments to sshrun().
At the moment, the name is fairly accurate because the arguments are limited to Control* related options aside from --port, but the next commits will add -4, -6, and -o.
Git sends protocol version information by sharing an environment variable value with `ssh -o SendEnv=...` as of v2.16.0, specifically 0c2f0d2703 (connect: tell server that the client understands v1, 2017-10-16). We set GIT_SSH_COMMAND to `datalad sshrun` (and GIT_SSH_VARIANT to "ssh"), so sshrun() needs to be able to handle this option too. This issue was revealed the `datalad create-sibling` call in the nipype_workshop_dataset.sh example of the datalad-neuroimaging repo. It's unclear why the DataLad's create_sibling() tests don't trigger the issue. Fixes datalad#3596.
FWIW -- I've failed to reproduce that python2 failure locally.
master build of datalad-neuroimaging (after a PR just merged) shows that it is unrelated to this PR python 2.7 issue since fails there too: https://travis-ci.org/datalad/datalad-neuroimaging/jobs/575650710
Why tests didn't fail for datalad core or for me locally with newer git (may be they started to "sense" capabilities of ssh differently) - also not clear to me as well.
But changes here make sense and fix travis, which is great. Left minor comment feel free to ignore
datalad/support/sshconnector.py
Outdated
lhost=gethostname(), | ||
rhost=hostname, | ||
port=port, | ||
identity_file=identity_file, | ||
username=username).encode('utf-8')).hexdigest()[:8] | ||
username=username, | ||
force_ip=force_ip |
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.
I would have for consistency had force_ip=False
in the signature of this function as well, and then do or ''
right here?
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.
I would have for consistency had
force_ip=False
in the signature of this function as well, and then door ''
right here?
Given the context, I wrote it how I did to be consistent with the other arguments. If I were writing the function from scratch, I'd have written it differently. But I must admit that I don't think this matters at all. I'm guessing you do since it elicited a comment, so I'll change it to the form you prefer.
When a command is set for GIT_SSH_COMMAND and GIT_SSH_VARIANT is ssh, Git expects the command to support the following parameters: [-p port] [-4] [-6] [-o option] [username@]host command With the last commit, we support all but -4 and -6. It seems unlikely that these flags would cause problems in the wild because they are specified via git push/fetch/pull, and we don't use those internally or expose them as options in any datalad command. But given we advertise sshrun() as a replacement for GIT_SSH_COMMAND, we should support all of the expected options.
Codecov Report
@@ Coverage Diff @@
## 0.11.x #3616 +/- ##
==========================================
- Coverage 81.41% 81.25% -0.16%
==========================================
Files 255 255
Lines 33734 33765 +31
==========================================
- Hits 27465 27437 -28
- Misses 6269 6328 +59
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## 0.11.x #3616 +/- ##
==========================================
- Coverage 81.41% 81.25% -0.16%
==========================================
Files 255 255
Lines 33734 33765 +31
==========================================
- Hits 27465 27437 -28
- Misses 6269 6328 +59
Continue to review full report at Codecov.
|
0.11.7 (Sep 02, 2019) -- python2-we-still-love-you-but-... Primarily bugfixes with some optimizations and refactorings. Fixes - [addurls][] - now provides better handling when the URL file isn't in the expected format. ([#3579][]) - always considered a relative file for the URL file argument as relative to the current working directory, which goes against the convention used by other commands of taking relative paths as relative to the dataset argument. ([#3582][]) - [run-procedure][] - hard coded "python" when formatting the command for non-executable procedures ending with ".py". `sys.executable` is now used. ([#3624][]) - failed if arguments needed more complicated quoting than simply surrounding the value with double quotes. This has been resolved for systems that support `shlex.quote`, but note that on Windows values are left unquoted. ([#3626][]) - [siblings][] now displays an informative error message if a local path is given to `--url` but `--name` isn't specified. ([#3555][]) - [sshrun][], the command DataLad uses for `GIT_SSH_COMMAND`, didn't support all the parameters that Git expects it to. ([#3616][]) - Fixed a number of Unicode py2-compatibility issues. ([#3597][]) Enhancements and new features - The [annotate-paths][] helper now caches subdatasets it has seen to avoid unnecessary calls. ([#3570][]) - A repeated configuration query has been dropped from the handling of `--proc-pre` and `--proc-post`. ([#3576][]) - Calls to `git annex find` now use `--in=.` instead of the alias `--in=here` to take advantage of an optimization that git-annex (as of the current release, 7.20190730) applies only to the former. ([#3574][]) - [addurls][] now suggests close matches when the URL or file format contains an unknown field. ([#3594][]) - Shared logic used in the setup.py files of Datalad and its extensions has been moved to modules in the _datalad_build_support/ directory. ([#3600][]) - Get ready for upcoming git-annex dropping support for direct mode ([#3631][]) * tag '0.11.7': (87 commits) DOC: Added an entry to changelogn on merged 3631 ENH: finalizing changelog for 0.11.7 TST: Update tests for a git-annex without direct mode TST: utils: Add decorator that skips when direct mode is unsupported ENH: annexrepo: Refuse to initialize in direct mode if unsupported ENH: annexrepo: Add check_direct_mode_support method BF+TST: Avoid leaking patched git-annex version TST+RF: test_annexrepo: Split up a test CHANGELOG.md: Second batch for 0.11.7 TST: run_procedure: Mark test_spaces() as known Windows failure TST: run_procedure: Mark test_quoting as known windows failure TST: run_procedure: Test more arguments that need quoting BF(py2): run_procedure: Avoid encoding error in log message TST: add run_procedure test with spaces in file name TST/RF: non-hardcoded Python executable RF: newline at end of file RF: helper instead of conditional RF: remove superfluous imports BF/TST: remove quoting ENH: replace conditionals with helper function ...
0.11.7 (Sep 02, 2019) -- python2-we-still-love-you-but-... Primarily bugfixes with some optimizations and refactorings. Fixes - [addurls][] - now provides better handling when the URL file isn't in the expected format. ([#3579][]) - always considered a relative file for the URL file argument as relative to the current working directory, which goes against the convention used by other commands of taking relative paths as relative to the dataset argument. ([#3582][]) - [run-procedure][] - hard coded "python" when formatting the command for non-executable procedures ending with ".py". `sys.executable` is now used. ([#3624][]) - failed if arguments needed more complicated quoting than simply surrounding the value with double quotes. This has been resolved for systems that support `shlex.quote`, but note that on Windows values are left unquoted. ([#3626][]) - [siblings][] now displays an informative error message if a local path is given to `--url` but `--name` isn't specified. ([#3555][]) - [sshrun][], the command DataLad uses for `GIT_SSH_COMMAND`, didn't support all the parameters that Git expects it to. ([#3616][]) - Fixed a number of Unicode py2-compatibility issues. ([#3597][]) - [download-url][] now will create leading directories of the output path if they do not exist ([#3646][]) Enhancements and new features - The [annotate-paths][] helper now caches subdatasets it has seen to avoid unnecessary calls. ([#3570][]) - A repeated configuration query has been dropped from the handling of `--proc-pre` and `--proc-post`. ([#3576][]) - Calls to `git annex find` now use `--in=.` instead of the alias `--in=here` to take advantage of an optimization that git-annex (as of the current release, 7.20190730) applies only to the former. ([#3574][]) - [addurls][] now suggests close matches when the URL or file format contains an unknown field. ([#3594][]) - Shared logic used in the setup.py files of Datalad and its extensions has been moved to modules in the _datalad_build_support/ directory. ([#3600][]) - Get ready for upcoming git-annex dropping support for direct mode ([#3631][]) * tag '0.11.7': Changelog entry for download-url paths handling ENH: downloaders: Ensure directories for target exist
This PR adjusts sshrun and sshconnector to fix the failure from gh-3596. This was originally observed with datalad-neuroimaging's nipype_workshop_dataset.sh example on Travis. As mentioned in gh-3596, I don't understand why our create_sibling() tests don't trigger the same failure in the Travis/Xenial environment. I've started a -neuroimaging build that uses this PR branch, and that appears to fix the failure (example 1, example 2). Note that there are other (hopefully unrelated) failures on python 2.