rhc 1.33.4 → 1.34.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rhc/commands/ssh.rb +5 -10
- data/lib/rhc/ssh_helpers.rb +2 -2
- data/spec/rhc/commands/ssh_spec.rb +3 -4
- metadata +4 -4
data/lib/rhc/commands/ssh.rb
CHANGED
@@ -15,6 +15,10 @@ module RHC::Commands
|
|
15
15
|
|
16
16
|
You may run a specific SSH command by passing one or more arguments, or use a
|
17
17
|
different SSH executable or pass options to SSH with the '--ssh' option.
|
18
|
+
|
19
|
+
To use the '--ssh' flag with an SSH executable path containing a space, wrap
|
20
|
+
the executable path with double quotes:
|
21
|
+
--ssh '"C:\\path with spaces\\ssh"'
|
18
22
|
DESC
|
19
23
|
syntax "[--ssh path_to_ssh_executable] [--gears] [<app> --] <command>"
|
20
24
|
takes_application :argument => true
|
@@ -42,16 +46,7 @@ module RHC::Commands
|
|
42
46
|
command_line = [RHC::Helpers.split_path(ssh), ('-vv' if debug?), rest_app.ssh_string.to_s, command].flatten.compact
|
43
47
|
|
44
48
|
debug "Invoking Kernel.exec with #{command_line.inspect}"
|
45
|
-
|
46
|
-
Kernel.send(:exec, *command_line)
|
47
|
-
rescue Errno::ENOENT
|
48
|
-
debug "SSH executable #{ssh.inspect} not found, splitting and trying again..."
|
49
|
-
|
50
|
-
command_line = [ssh.chomp('"').reverse.chomp('"').reverse.split(' '), ('-vv' if debug?), rest_app.ssh_string.to_s, command].flatten.compact
|
51
|
-
debug "Invoking Kernel.exec with #{command_line.inspect}"
|
52
|
-
|
53
|
-
Kernel.send(:exec, *command_line)
|
54
|
-
end
|
49
|
+
Kernel.send(:exec, *command_line)
|
55
50
|
end
|
56
51
|
end
|
57
52
|
|
data/lib/rhc/ssh_helpers.rb
CHANGED
@@ -475,10 +475,10 @@ module RHC
|
|
475
475
|
raise RHC::InvalidSSHExecutableException.new("No system SSH available. Please use the --ssh option to specify the path to your SSH executable, or install SSH.#{windows? ? ' We recommend this free application: Git for Windows - a basic git command line and GUI client http://msysgit.github.io/.' : ''}") unless ssh_cmd or has_ssh?
|
476
476
|
end
|
477
477
|
else
|
478
|
-
bin_path = path
|
478
|
+
bin_path = split_path(path)[0]
|
479
479
|
raise RHC::InvalidSSHExecutableException.new("SSH executable '#{bin_path}' does not exist.") unless File.exist?(bin_path) or File.exist?(path) or exe?(bin_path)
|
480
480
|
raise RHC::InvalidSSHExecutableException.new("SSH executable '#{bin_path}' is not executable.") unless File.executable?(path) or File.executable?(bin_path) or exe?(bin_path)
|
481
|
-
path
|
481
|
+
path
|
482
482
|
end
|
483
483
|
end
|
484
484
|
|
@@ -171,8 +171,8 @@ describe RHC::Commands::Ssh do
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
-
describe 'app ssh custom ssh with spaces' do
|
175
|
-
let(:arguments) { ['app', 'ssh', 'app1', '--ssh', '/path/to/ssh --with_custom_flag'] }
|
174
|
+
describe 'app ssh custom ssh with spaces and arguments' do
|
175
|
+
let(:arguments) { ['app', 'ssh', 'app1', '--ssh', '"/path/to /ssh" --with_custom_flag'] }
|
176
176
|
context 'when custom ssh does not exist as a path' do
|
177
177
|
before(:each) do
|
178
178
|
@domain = rest_client.add_domain("mockdomain")
|
@@ -181,8 +181,7 @@ describe RHC::Commands::Ssh do
|
|
181
181
|
File.should_receive(:exist?).at_least(1).and_return(true)
|
182
182
|
File.should_receive(:executable?).at_least(1).and_return(true)
|
183
183
|
subject.class.any_instance.stub(:discover_git_executable).and_return('git')
|
184
|
-
Kernel.should_receive(:exec).with(
|
185
|
-
Kernel.should_receive(:exec).with('/path/to/ssh', '--with_custom_flag', "fakeuuidfortestsapp1@127.0.0.1").once.times.and_return(0)
|
184
|
+
Kernel.should_receive(:exec).with("/path/to /ssh", '--with_custom_flag', "fakeuuidfortestsapp1@127.0.0.1").once.times.and_return(0)
|
186
185
|
end
|
187
186
|
it { expect { run }.to exit_with_code(0) }
|
188
187
|
end
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 34
|
9
|
+
- 2
|
10
|
+
version: 1.34.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Red Hat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2015-01-17 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: net-ssh
|