ridley-connectors 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ridley-connectors/host_commander.rb +12 -5
- data/lib/ridley-connectors/host_connector/ssh.rb +11 -1
- data/lib/ridley-connectors/host_connector/winrm.rb +11 -1
- data/lib/ridley-connectors/resources/node_resource.rb +2 -2
- data/lib/ridley-connectors/version.rb +1 -1
- data/spec/unit/ridley-connectors/host_connector/ssh_spec.rb +1 -1
- data/spec/unit/ridley-connectors/host_connector/winrm_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd45d75b75804bf01b13a5126297aacfd5fc455
|
4
|
+
data.tar.gz: 63e286faecab868eed92362d49771c1c591aad96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49691e61efceb7a88fc5a4a5617b4f8364e9e074ef3d86079aedf2a7f3fa9f89d5ca59a4152f77a9be3ecc2f1d6e03512411f8d2f757d36a921843ae27fae55e
|
7
|
+
data.tar.gz: aabf718fdde84bdb5a210038ac319bcf53a56dc638ae39c642ab42ae7f6e65083f8d65b6a225f97fac4a4f1467b10870146e6bb4f3c389e953381c2b1d60d293
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## v.1.6.0
|
2
|
+
* [#14](https://github.com/RiotGames/ridley-connectors/pull/14) Create
|
3
|
+
a pool of WinRM / SSH actors, configurable with options(:connector\_pool\_size)
|
4
|
+
|
1
5
|
## v.1.5.0
|
2
6
|
* [#11](https://github.com/RiotGames/ridley-connectors/pull/11) use -E on sudo to preserve the environment
|
3
7
|
|
@@ -1,10 +1,16 @@
|
|
1
1
|
module Ridley
|
2
2
|
class ConnectorSupervisor < ::Celluloid::SupervisionGroup
|
3
3
|
# @param [Celluloid::Registry] registry
|
4
|
-
def initialize(registry)
|
4
|
+
def initialize(registry, connector_pool_size)
|
5
5
|
super(registry)
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
if connector_pool_size > 1
|
8
|
+
pool(HostConnector::SSH, size: connector_pool_size, as: :ssh)
|
9
|
+
pool(HostConnector::WinRM, size: connector_pool_size, as: :winrm)
|
10
|
+
else
|
11
|
+
supervise_as :ssh, HostConnector::SSH
|
12
|
+
supervise_as :winrm, HostConnector::WinRM
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
10
16
|
|
@@ -16,9 +22,10 @@ module Ridley
|
|
16
22
|
|
17
23
|
finalizer :finalize_callback
|
18
24
|
|
19
|
-
def initialize
|
25
|
+
def initialize(connector_pool_size=nil)
|
26
|
+
connector_pool_size ||= 1
|
20
27
|
@connector_registry = Celluloid::Registry.new
|
21
|
-
@connector_supervisor = ConnectorSupervisor.new_link(@connector_registry)
|
28
|
+
@connector_supervisor = ConnectorSupervisor.new_link(@connector_registry, connector_pool_size)
|
22
29
|
end
|
23
30
|
|
24
31
|
# Execute a shell command on a node
|
@@ -113,7 +113,17 @@ module Ridley
|
|
113
113
|
#
|
114
114
|
# @return [HostConnector::Response]
|
115
115
|
def chef_client(host, options = {})
|
116
|
-
|
116
|
+
log_level = case log.level
|
117
|
+
when 0
|
118
|
+
"debug"
|
119
|
+
when 1
|
120
|
+
"info"
|
121
|
+
when 2
|
122
|
+
"warn"
|
123
|
+
else
|
124
|
+
"info"
|
125
|
+
end
|
126
|
+
run(host, "chef-client -l #{log_level}", options)
|
117
127
|
end
|
118
128
|
|
119
129
|
# Write your encrypted data bag secret on a node
|
@@ -143,7 +143,17 @@ module Ridley
|
|
143
143
|
#
|
144
144
|
# @return [HostConnector::Response]
|
145
145
|
def chef_client(host, options = {})
|
146
|
-
|
146
|
+
log_level = case log.level
|
147
|
+
when 0
|
148
|
+
"debug"
|
149
|
+
when 1
|
150
|
+
"info"
|
151
|
+
when 2
|
152
|
+
"warn"
|
153
|
+
else
|
154
|
+
"info"
|
155
|
+
end
|
156
|
+
run(host, "chef-client -l #{log_level}", options)
|
147
157
|
end
|
148
158
|
|
149
159
|
# Write your encrypted data bag secret on a node
|
@@ -40,7 +40,7 @@ module Ridley
|
|
40
40
|
@ssh = options[:ssh]
|
41
41
|
@winrm = options[:winrm]
|
42
42
|
@chef_version = options[:chef_version]
|
43
|
-
@host_commander = HostCommander.new_link
|
43
|
+
@host_commander = HostCommander.new_link(options[:connector_pool_size])
|
44
44
|
end
|
45
45
|
|
46
46
|
# @param [String] host
|
@@ -193,6 +193,6 @@ module Ridley
|
|
193
193
|
|
194
194
|
def finalize_callback
|
195
195
|
@host_commander.terminate if @host_commander && @host_commander.alive?
|
196
|
-
end
|
196
|
+
end
|
197
197
|
end
|
198
198
|
end
|
@@ -32,7 +32,7 @@ describe Ridley::HostConnector::SSH do
|
|
32
32
|
|
33
33
|
describe "#chef_client" do
|
34
34
|
it "sends a #run message to self to execute chef-client" do
|
35
|
-
connector.should_receive(:run).with(host, "chef-client", options)
|
35
|
+
connector.should_receive(:run).with(host, "chef-client -l warn", options)
|
36
36
|
connector.chef_client(host, options)
|
37
37
|
end
|
38
38
|
end
|
@@ -129,7 +129,7 @@ describe Ridley::HostConnector::WinRM do
|
|
129
129
|
subject(:chef_client) { connector.chef_client(host, options) }
|
130
130
|
|
131
131
|
it "receives a command to run chef-client" do
|
132
|
-
connector.should_receive(:run).with(host, "chef-client", options)
|
132
|
+
connector.should_receive(:run).with(host, "chef-client -l warn", options)
|
133
133
|
|
134
134
|
chef_client
|
135
135
|
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: 1.
|
4
|
+
version: 1.6.0
|
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-03-
|
12
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid
|