Bug 1310813 - rhc ssh <appname> does not respect PATH env variable, nor the --ssh PATH option
Summary: rhc ssh <appname> does not respect PATH env variable, nor the --ssh PATH option
Keywords:
Status: CLOSED DUPLICATE of bug 1307174
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 2.2.0
Hardware: x86_64
OS: Windows
unspecified
medium
Target Milestone: ---
: ---
Assignee: Sally
QA Contact: Wei Sun
URL:
Whiteboard:
Depends On: 1294401
Blocks: 1307174
TreeView+ depends on / blocked
 
Reported: 2016-02-22 17:22 UTC by Rory Thrasher
Modified: 2016-02-22 20:33 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1294401
Environment:
Last Closed: 2016-02-22 20:33:55 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Rory Thrasher 2016-02-22 17:22:53 UTC
Enterprise clone for documentation purposes.

+++ This bug was initially created as a clone of Bug #1294401 +++

Description of problem:

- Running Windows 10 Home Edition

- Installed Ruby from http://rubyinstaller.org/downloads/
    (ruby 2.1.7p400 (2015-08-18 revision 51632) [i386-mingw32]

- Installed Git from https://git-for-windows.github.io/
    (git version 2.6.4.windows.1)

- Installed rhc using: gem install rhc
    (rhc (1.38.4))

- Ran rhc setup. All steps appeared to complete successfully

- Attempted to connect via ssh using: rhc ssh <appname>

- Received the following message:
    No system SSH available. Please use the --ssh option to specify the path to your SSH executable, or install SSH. We
recommend this free application: Git for Windows - a basic git command line and GUI client http://msysgit.github.io/.

- Verified that set PATH included: C:\Program Files\Git\usr\bin

- Verified that C:\Program Files\Git\usr\bin contained ssh.exe

- Attempted to connect via ssh using: 
    rhc ssh <appname> --ssh "C:\Program Files\Git\usr\bin\ssh.exe"

- Received the following messages:
C:/Ruby21/lib/ruby/gems/2.1.0/gems/rhc-1.38.4/lib/rhc/commands/ssh.rb:49:in `exec': No such file or directory - C:\Program (Errno::ENOENT)
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rhc-1.38.4/lib/rhc/commands/ssh.rb:49:in `run'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rhc-1.38.4/lib/rhc/commands.rb:294:in `execute'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rhc-1.38.4/lib/rhc/commands.rb:285:in `block (3 levels) in to_commander'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rhc-1.38.4/lib/rhc/command_runner.rb:72:in `run!'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rhc-1.38.4/lib/rhc/cli.rb:37:in `start'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rhc-1.38.4/bin/rhc:20:in `<top (required)>'
        from C:/Ruby21/bin/rhc:23:in `load'
        from C:/Ruby21/bin/rhc:23:in `<main>'

- Copied ssh.exe from C:\Program Files\Git\usr\bin to C:\Program Files\Git\bin

- Attempted to connect via ssh using: rhc ssh <appname>

- SUCCESS: Finally managed to connect successfully!


Version-Release number of selected component (if applicable):
    rhc (1.38.4)


How reproducible:
    Consistently reproducible

Steps to Reproduce:
    (see Description of problem)

Actual results:
    Even with the PATH environment variable including the folder containing ssh.exe, the rhc ssh command failed.

    Even when the --ssh option was applied to the rhc ssh command to specify the path to the ssh.exe file, the command failed.

    The only way to get the rhc ssh command to work was to copy the ssh.exe file from the C:\Program Files\Git\usr\bin folder to the C:\Program Files\Git\bin folder.


Expected results:
    Should not have to copy ssh.exe to another folder to get the rhc ssh command to work


Additional info:
    Possible solutions:
    1. Include C:\Program Files\Git\usr\bin in the search path.
    2. Include the PATH folders in the search path.
    3. Fix whatever is causing the --ssh option to fail.
    4. The no system SSH message recommends installing Git from http://msysgit.github.io/, which according to its Github repo is now obsolete, having been superseded by https://git-for-windows.github.io/.

--- Additional comment from  on 2016-01-21 08:54:47 EST ---

face the same issue, hope a solution

--- Additional comment from Yanping Zhang on 2016-02-01 06:11:54 EST ---

Tested with rhc-1.38.6 from the libra-rhel-6-stage/client/gems/, the issue seems still there. Where can I get the rhc gem file that contains the fix for the bug?

--- Additional comment from Sally on 2016-02-01 06:35 EST ---

please use the attached gemfile for testing, thanks.

--- Additional comment from Yanping Zhang on 2016-02-02 00:41:33 EST ---

1.Install rhc-1.38.4.gem from attachment on win10
2.Login openshift server:
C:\Users\openshift>rhc setup --server=<serverip>
3.Ssh into app. Now we can ssh into app with default ssh successfully:
3.1 Ssh using Win cmd or ruby bash:
C:\Users\openshift>rhc ssh php1
Connecting to 56af35d735348f0625000668.com.cn ...
......
[php1-domzyp.ose-22.com.cn 56af35d735348f0625000668]\>ls
app-deployments app-root git php
[php1-domzyp.ose-22.com.cn 56af35d735348f0625000668]\>exit
Connection to php1-domzyp.ose-22.com.cn closed
3.2 Ssh using git bash:
$rhc ssh php1 
Connecting to 56af35d735348f0625000668.com.cn ...
......
[php1-domzyp.ose-22.com.cn 56af35d735348f0625000668]\>

4.Ssh into app with --ssh option
4.1 Ssh using Win cmd or ruby bash,it aborts when connecting:
C:\Users\openshift>rhc ssh php1 --ssh "C:\Users\openshift\ssh.exe"
Connecting to 56af35d735348f0625000668.com.cn ...
4.2 Ssh using git bash, it succeeds:
$rhc ssh php1 --ssh "C:\Users\openshift\ssh.exe"
Connecting to 56af35d735348f0625000668.com.cn ...
......
[php1-domzyp.ose-22.com.cn 56af35d735348f0625000668]\>ls

From the step 4.1, there is issue when using --ssh option in ruby bash, Pls help to check. Others works well.

--- Additional comment from Sally on 2016-02-02 10:27:03 EST ---

Please use the updated .gem file

--- Additional comment from Sally on 2016-02-02 10:28 EST ---

Please re-test using the attached .gem build from the master branch.  Thanks.

--- Additional comment from Sally on 2016-02-02 10:37:03 EST ---

QA: Please re-test.  I followed your steps from Comment 4 and everything seems to work on my end.  Did you make a new directory 'openshift' and cp 'ssh.exe' there?  I put a cp of 'ssh.exe' in 'C:\Users\.openshift' and gave that path to ssh cmd:

(From C:\Users\root\rhc directory):

rhc ssh --ssh ../.openshift/ssh.exe testapp

and I was able to ssh in no problems. I did this from Power shell, Ruby cmd prompt and Git Bash.  Thank you for re-testing!

--- Additional comment from Yanping Zhang on 2016-02-03 06:10:02 EST ---

@Sally
I made a new directory such as testdir, and cp ssh.exe into the directory, then rhc ssh --ssh "C:\testdir\ssh.exe" seperately in ruby cmd/win cmd/git bash. Only succeeded in git bash. Same results when I cp "ssh.exe" into .openshift directory and used ../.openshift/ssh.exe path.

Another discovery, if the --ssh using the ssh.exe under Git: rhc ssh app --ssh "<Gitpath>\usr\bin\ssh.exe",it can succeed in all bash:ruby cmd/win cmd/git bash

Pls check again, here is my system info:
Ruby version 2.1.7p400
Windows 10
git 2.7.0

--- Additional comment from Sally on 2016-02-04 13:55:46 EST ---

@Yanping, thanks for the info!  What's happening is git for Windows (msysgit's) ssh.exe is not meant to be run outside of the Git env.  It needs several msys*.dll files to run.  The behavior we are seeing is expected.  Users may use putty.exe instead, for example, but so long as they are using msysgit's ssh.exe it has to a) be run from Git Bash OR b) be in the Git env

The 'rhc ssh --ssh <path to ssh.exe> <app>' is actually working fine, it is locating and running the ssh.exe file.  The program can't find several msys*.dll files if the ssh.exe is in a place outside of Git env so it doesn't fully execute.  We can expect that users would not move ssh.exe somewhere wacky AND try to run rhc ssh --ssh from outside of Git Bash.  

Users can (and probably do) place the ssh.exe file in a custom location and run the cmd 'rhc ssh --ssh <path to ssh.exe> <app>' successfully IF they are running from Git Bash, bc Git Bash knows where the necessary 'msys*.dll' files are.

--- Additional comment from Yanping Zhang on 2016-02-15 02:58:03 EST ---

Since the "rhc ssh --ssh <path to ssh.exe> appname" works in Git Bash or in the Git env by design according to comment 8 and comment 9. So move the bug to verified.

Comment 1 Rory Thrasher 2016-02-22 20:33:55 UTC
Looks like an enterprise clone was already created for this.

*** This bug has been marked as a duplicate of bug 1307174 ***


Note You need to log in before you can comment on or make changes to this bug.