ridley-connectors 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83951fdd4b407da750f1650dda96da6092dc5d87
|
|
4
|
+
data.tar.gz: 6781793e33583fb2a2a0c66803daaa93a3bd6a5b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e948a143d321f8036a4ca2bdb1c03551082a90f7de15622df2e5cfc70c5937399eb619855a04c43bfbee639ad20f5d62f0781f0479ba7c255e4d97d04e38e85
|
|
7
|
+
data.tar.gz: 80e8ebdc8e53faf8096eb541d291a89813db4914fdb0cfac5b47d12bde0d2ebda245a9d4d9e91a6dcf12facaa81141b62020775f6ddd2e4f1b42078989fb311b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## v.2.1.2
|
|
2
|
+
|
|
3
|
+
* [#25](https://github.com/RiotGames/ridley-connectors/pull/25) Fix an edge case in the connector_for logic from #22
|
|
4
|
+
|
|
1
5
|
## v.2.1.1
|
|
2
6
|
|
|
3
7
|
* [#24](https://github.com/RiotGames/ridley-connectors/pull/24) Fix a bug with Timeout.rb unable to interrupt Socket connections (mostly JRuby)
|
|
@@ -29,6 +29,8 @@ module Ridley
|
|
|
29
29
|
DEFAULT_WINDOWS_CONNECTOR = "winrm"
|
|
30
30
|
DEFAULT_LINUX_CONNECTOR = "ssh"
|
|
31
31
|
|
|
32
|
+
VALID_CONNECTORS = [ DEFAULT_WINDOWS_CONNECTOR, DEFAULT_LINUX_CONNECTOR ]
|
|
33
|
+
|
|
32
34
|
CONNECTOR_PORT_ERRORS = [
|
|
33
35
|
Errno::ETIMEDOUT, Timeout::Error, SocketError,
|
|
34
36
|
Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL,
|
|
@@ -216,6 +218,11 @@ module Ridley
|
|
|
216
218
|
|
|
217
219
|
connector = options[:connector]
|
|
218
220
|
|
|
221
|
+
if !VALID_CONNECTORS.include?(connector)
|
|
222
|
+
log.warn { "Received connector '#{connector}' is not one of #{VALID_CONNECTORS}. Checking default connectors..." }
|
|
223
|
+
connector = nil
|
|
224
|
+
end
|
|
225
|
+
|
|
219
226
|
if (connector == DEFAULT_WINDOWS_CONNECTOR || connector.nil?) && connector_port_open?(host, options[:winrm][:port], options[:winrm][:timeout], options[:retries])
|
|
220
227
|
options.delete(:ssh)
|
|
221
228
|
winrm
|
|
@@ -167,6 +167,9 @@ describe Ridley::HostCommander do
|
|
|
167
167
|
end
|
|
168
168
|
|
|
169
169
|
describe "#connector_for" do
|
|
170
|
+
let(:options) do
|
|
171
|
+
{ ssh: { port: 22, timeout: 3 }, winrm: { port: 5985, timeout: 3 }, retries: 3 }
|
|
172
|
+
end
|
|
170
173
|
|
|
171
174
|
context "when connector_port_open? experiences an error" do
|
|
172
175
|
let(:socket) { double(close: true) }
|
|
@@ -206,40 +209,45 @@ describe Ridley::HostCommander do
|
|
|
206
209
|
end
|
|
207
210
|
|
|
208
211
|
context "when a connector of winrm is given" do
|
|
209
|
-
let(:options)
|
|
210
|
-
{ ssh: { port: 22, timeout: 3 }, winrm: { port: 5985, timeout: 3 }, retries: 3, connector: "winrm" }
|
|
211
|
-
end
|
|
212
|
+
let(:connector_options) { options.merge(connector: "winrm") }
|
|
212
213
|
let(:winrm) { double }
|
|
213
214
|
|
|
214
215
|
it "should return winrm if winrm is open" do
|
|
215
216
|
subject.stub(:connector_port_open?).with(host, Ridley::HostConnector::WinRM::DEFAULT_PORT, anything, anything).and_return(true)
|
|
216
217
|
subject.stub(:winrm).and_return(winrm)
|
|
217
|
-
expect(subject.connector_for(host,
|
|
218
|
+
expect(subject.connector_for(host, connector_options)).to eql(winrm)
|
|
218
219
|
end
|
|
219
220
|
|
|
220
221
|
it "should return nil if winrm is closed" do
|
|
221
222
|
subject.stub(:connector_port_open?).with(host, Ridley::HostConnector::WinRM::DEFAULT_PORT, anything, anything).and_return(false)
|
|
222
|
-
expect(subject.connector_for(host,
|
|
223
|
+
expect(subject.connector_for(host, connector_options)).to be_nil
|
|
223
224
|
end
|
|
224
225
|
end
|
|
225
226
|
|
|
226
227
|
context "when a connector of ssh is given" do
|
|
227
|
-
let(:options)
|
|
228
|
-
{ ssh: { port: 22, timeout: 3 }, winrm: { port: 5985, timeout: 3 }, retries: 3, connector: "ssh" }
|
|
229
|
-
end
|
|
228
|
+
let(:connector_options) { options.merge(connector: "ssh") }
|
|
230
229
|
let(:ssh) { double }
|
|
231
230
|
|
|
232
231
|
it "should return ssh if ssh is open" do
|
|
233
232
|
subject.stub(:connector_port_open?).with(host, Ridley::HostConnector::SSH::DEFAULT_PORT, anything, anything).and_return(true)
|
|
234
233
|
subject.stub(:ssh).and_return(ssh)
|
|
235
234
|
subject.should_not_receive(:connector_port_open?).with(host, Ridley::HostConnector::WinRM::DEFAULT_PORT, anything, anything)
|
|
236
|
-
expect(subject.connector_for(host,
|
|
235
|
+
expect(subject.connector_for(host, connector_options)).to eql(ssh)
|
|
237
236
|
end
|
|
238
237
|
|
|
239
238
|
it "should return nil if ssh is closed" do
|
|
240
239
|
subject.stub(:connector_port_open?).with(host, Ridley::HostConnector::SSH::DEFAULT_PORT, anything, anything).and_return(false)
|
|
241
240
|
subject.should_not_receive(:connector_port_open?).with(host, Ridley::HostConnector::WinRM::DEFAULT_PORT, anything, anything)
|
|
242
|
-
expect(subject.connector_for(host,
|
|
241
|
+
expect(subject.connector_for(host, connector_options)).to be_nil
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
context "when an unknown connector is given" do
|
|
246
|
+
let(:connector_options) { options.merge(connector: "foo") }
|
|
247
|
+
|
|
248
|
+
it "should try both connectors" do
|
|
249
|
+
subject.should_receive(:connector_port_open?).twice
|
|
250
|
+
subject.connector_for(host, connector_options)
|
|
243
251
|
end
|
|
244
252
|
end
|
|
245
253
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ridley-connectors
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamie Winsor
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
12
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: celluloid
|