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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 664cd3f5806e0266a72564fcaff7dedb8678cfb1
4
- data.tar.gz: 8d2e751c31d0778940a3ea617ca6c1e7b93a9266
3
+ metadata.gz: 6fd45d75b75804bf01b13a5126297aacfd5fc455
4
+ data.tar.gz: 63e286faecab868eed92362d49771c1c591aad96
5
5
  SHA512:
6
- metadata.gz: a95132ce067326292a51f49e6b2fd48cc3600a81c1f27838d75bf55fd2defd38a48d8bf083779aefa89351fb4c85b79e892b2b45fb7a055d810bdac41e67793c
7
- data.tar.gz: b8fd1f621e77b5c23a882055e1a1afa4bf936c185e289a217195024bc5d63383bc4abedf4275aa2110fa31f89e15ce62662971a5098b9c26b9352cf998bcedc0
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
- supervise_as :ssh, HostConnector::SSH
7
- supervise_as :winrm, HostConnector::WinRM
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
- run(host, "chef-client", options)
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
- run(host, "chef-client", options)
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
@@ -1,5 +1,5 @@
1
1
  module Ridley
2
2
  module Connectors
3
- VERSION = '1.5.0'
3
+ VERSION = '1.6.0'
4
4
  end
5
5
  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.5.0
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-06 00:00:00.000000000 Z
12
+ date: 2014-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid