Skip to content
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

Merged
merged 4 commits into from Aug 23, 2019

Conversation

@kyleam
Copy link
Member

commented Aug 23, 2019

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.

kyleam added 3 commits Aug 22, 2019
ENH: sshrun: Improve readability of a debug message
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().
RF: sshconnector: Rename _ctrl_options to _ssh_args
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.
BF: sshrun: Accept -o flag
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 #3596.
@yarikoptic
Copy link
Member

left a comment

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

lhost=gethostname(),
rhost=hostname,
port=port,
identity_file=identity_file,
username=username).encode('utf-8')).hexdigest()[:8]
username=username,
force_ip=force_ip

This comment has been minimized.

Copy link
@yarikoptic

yarikoptic Aug 23, 2019

Member

I would have for consistency had force_ip=False in the signature of this function as well, and then do or '' right here?

This comment has been minimized.

Copy link
@kyleam

kyleam Aug 23, 2019

Author Member

I would have for consistency had force_ip=False in the signature of this function as well, and then do or '' 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.

BF: sshrun: Add -4 and -6 for full Git compatibility
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.

@kyleam kyleam force-pushed the kyleam:sshrun-compat branch from f81bc62 to a654605 Aug 23, 2019

@codecov

This comment has been minimized.

Copy link

commented Aug 23, 2019

Codecov Report

Merging #3616 into 0.11.x will decrease coverage by 0.15%.
The diff coverage is 75.86%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
datalad/support/tests/test_sshrun.py 97.77% <100%> (+1.77%) ⬆️
datalad/support/sshrun.py 90% <72.72%> (-6.97%) ⬇️
datalad/support/sshconnector.py 69.19% <73.33%> (-0.38%) ⬇️
datalad/interface/run_procedure.py 67.08% <0%> (-20.89%) ⬇️
datalad/interface/unlock.py 64.19% <0%> (-13.59%) ⬇️
datalad/interface/run.py 67.66% <0%> (-1.5%) ⬇️
datalad/support/json_py.py 95.94% <0%> (-1.36%) ⬇️
datalad/support/annexrepo.py 58.52% <0%> (-0.52%) ⬇️
datalad/utils.py 64.19% <0%> (-0.33%) ⬇️
datalad/support/network.py 82.52% <0%> (-0.23%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2870060...a654605. Read the comment docs.

1 similar comment
@codecov

This comment has been minimized.

Copy link

commented Aug 23, 2019

Codecov Report

Merging #3616 into 0.11.x will decrease coverage by 0.15%.
The diff coverage is 75.86%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
datalad/support/tests/test_sshrun.py 97.77% <100%> (+1.77%) ⬆️
datalad/support/sshrun.py 90% <72.72%> (-6.97%) ⬇️
datalad/support/sshconnector.py 69.19% <73.33%> (-0.38%) ⬇️
datalad/interface/run_procedure.py 67.08% <0%> (-20.89%) ⬇️
datalad/interface/unlock.py 64.19% <0%> (-13.59%) ⬇️
datalad/interface/run.py 67.66% <0%> (-1.5%) ⬇️
datalad/support/json_py.py 95.94% <0%> (-1.36%) ⬇️
datalad/support/annexrepo.py 58.52% <0%> (-0.52%) ⬇️
datalad/utils.py 64.19% <0%> (-0.33%) ⬇️
datalad/support/network.py 82.52% <0%> (-0.23%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2870060...a654605. Read the comment docs.

@yarikoptic yarikoptic merged commit f359788 into datalad:0.11.x Aug 23, 2019

3 checks passed

WIP Ready for review
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kyleam kyleam deleted the kyleam:sshrun-compat branch Aug 23, 2019

yarikoptic added a commit that referenced this pull request Sep 6, 2019
Merge tag '0.11.7' into debian
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
  ...
yarikoptic added a commit that referenced this pull request Sep 6, 2019
Merge tag '0.11.7' into debian
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.