Bug 1307174 - rhc ssh <appname> does not respect PATH env variable, nor the --ssh PATH option
rhc ssh <appname> does not respect PATH env variable, nor the --ssh PATH option
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
2.2.0
x86_64 Windows
unspecified Severity medium
: ---
: ---
Assigned To: Sally
Wei Sun
:
: 1310813 (view as bug list)
Depends On: 1294401 1310813
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-12 17:29 EST by Miciah Dashiel Butler Masters
Modified: 2016-03-22 12:54 EDT (History)
9 users (show)

See Also:
Fixed In Version: rhc-1.38.6.1-1.el6op
Doc Type: Bug Fix
Doc Text:
Cause: 'rhc ssh <app>' was not working in Windows, unless ssh.exe was copied from the C:\Program Files\Git\usr\bin folder to the C:\Program Files\Git\bin folder. Also the link to Git for Windows mysysgit install was broken. Consequence: rhc was broken for Windows users Fix: Added C:\Program Files\Git\usr\bin to the search path for ssh.exe. Users can also move ssh.exe to a custom location, as long as it is in the Git path rhc will find it. Also replaced 'http://msysgit.github.io/' with the updated url 'https://git-for-windows.github.io/'. Result: 'rhc ssh' works as expected for Windows users
Story Points: ---
Clone Of: 1294401
Environment:
Last Closed: 2016-03-22 12:54:17 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Miciah Dashiel Butler Masters 2016-02-12 17:29:53 EST
+++ 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@php1-domzyp.ose-22.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@php1-domzyp.ose-22.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@php1-domzyp.ose-22.com.cn ...
4.2 Ssh using git bash, it succeeds:
$rhc ssh php1 --ssh "C:\Users\openshift\ssh.exe"
Connecting to 56af35d735348f0625000668@php1-domzyp.ose-22.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.
Comment 4 Rory Thrasher 2016-02-22 15:33:55 EST
*** Bug 1310813 has been marked as a duplicate of this bug. ***
Comment 7 Yanping Zhang 2016-02-29 04:21:56 EST
Tested with RHC 1.38.6.1 Gem on puddle 2.2/2016-02-25.2/, it works as expected.
Steps to verify:
1.Install rhc-1.38.6.1 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. Ssh using Win cmd,ruby bash or git bash:
C:\Users\openshift>rhc ssh php1
DL is deprecated, please use Fiddle
Connecting to domtest-php1-1@php1-domtest.ose22-auto.com.cn ...
[php1-domtest.ose22-auto.com.cn domtest-php1-1]\> exit
exit
4.Ssh into app with --ssh option successfully using Win cmd,ruby bash or git bash:
C:\Users\openshift>rhc ssh php1 --ssh="C:\ProgramData\Git\usr\bin\ssh.exe"
DL is deprecated, please use Fiddle
Connecting to domtest-php1-1@php1-domtest.ose22-auto.com.cn ...
[php1-domtest.ose22-auto.com.cn domtest-php1-1]\> exit
exit

The bug has been fixed, so move it to Verified.
Comment 9 errata-xmlrpc 2016-03-22 12:54:17 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-0489.html

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