motherbrain 0.14.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/lib/mb/cli_gateway/sub_commands/environment.rb +8 -1
- data/lib/mb/config.rb +10 -0
- data/lib/mb/environment_manager.rb +30 -1
- data/lib/mb/version.rb +1 -1
- data/motherbrain.gemspec +1 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 487c01b8a8a569d17138c7208f165139864ef4ff
|
4
|
+
data.tar.gz: 98c88f8faa6ab6470bfe0d59cc34fcb85eb14f77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c21287087e19aa6bec75950753a4f5b72036a8f034d92e3948c9e535b39d1c90a79039e2ab9695b08248b67af5e67c8d4be742ec387307d7cbf8e1b38a827913
|
7
|
+
data.tar.gz: 906a7a13e369811987d7c83563787f317ca0e2b16ef21e618e78e5deb3064a8eb566bd5665c291210743b9b04650887d42336d31abecfb53d962e82c06192748
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -108,7 +108,7 @@ module MotherBrain
|
|
108
108
|
desc "create ENVIRONMENT", "Create an empty environment"
|
109
109
|
def create(environment)
|
110
110
|
ui.say "Creating empty environment #{environment}"
|
111
|
-
|
111
|
+
|
112
112
|
begin
|
113
113
|
environment_manager.create(environment)
|
114
114
|
rescue => e
|
@@ -116,6 +116,13 @@ module MotherBrain
|
|
116
116
|
exit(1)
|
117
117
|
end
|
118
118
|
end
|
119
|
+
|
120
|
+
desc "examine ENVIRONMENT", "Examine nodes in a Chef environment"
|
121
|
+
def examine(environment)
|
122
|
+
job = environment_manager.async_examine_nodes(environment)
|
123
|
+
|
124
|
+
CliClient.new(job).display
|
125
|
+
end
|
119
126
|
end
|
120
127
|
end
|
121
128
|
|
data/lib/mb/config.rb
CHANGED
@@ -121,6 +121,10 @@ module MotherBrain
|
|
121
121
|
default: true,
|
122
122
|
type: Boolean
|
123
123
|
|
124
|
+
attribute 'ridley.connector_pool_size',
|
125
|
+
default: 25,
|
126
|
+
type: Integer
|
127
|
+
|
124
128
|
attribute 'log.level',
|
125
129
|
default: 'INFO',
|
126
130
|
type: String,
|
@@ -254,6 +258,12 @@ module MotherBrain
|
|
254
258
|
ridley_opts[:ssl] = {
|
255
259
|
verify: self.ssl.verify
|
256
260
|
}
|
261
|
+
|
262
|
+
ridley_opts[:connector_pool_size] = if ENV.has_key?('MB_CONNECTOR_POOL')
|
263
|
+
ENV['MB_CONNECTOR_POOL'].to_i
|
264
|
+
else
|
265
|
+
ridley.connector_pool_size
|
266
|
+
end
|
257
267
|
ridley_opts[:ssh][:verbose] = ridley_opts[:ssh][:verbose].to_sym if ridley_opts[:ssh][:verbose]
|
258
268
|
end
|
259
269
|
end
|
@@ -103,6 +103,35 @@ module MotherBrain
|
|
103
103
|
job.terminate if job && job.alive?
|
104
104
|
end
|
105
105
|
|
106
|
+
|
107
|
+
def async_examine_nodes(id, options = {})
|
108
|
+
job = Job.new(:examine_nodes)
|
109
|
+
async(:examine_nodes, job, id, options)
|
110
|
+
|
111
|
+
job.ticket
|
112
|
+
end
|
113
|
+
|
114
|
+
def examine_nodes(job, id, options = {})
|
115
|
+
environment = find(id)
|
116
|
+
job.report_running("Finding environment #{environment.name}")
|
117
|
+
nodes = nodes_for_environment(environment.name)
|
118
|
+
|
119
|
+
job.set_status("Examining #{nodes.length} nodes")
|
120
|
+
nodes.collect do |node|
|
121
|
+
log.debug "About to execute on #{node.public_hostname}"
|
122
|
+
node_querier.future(:execute_command, node.public_hostname, "echo %time%")
|
123
|
+
end.each do |future|
|
124
|
+
begin
|
125
|
+
response = future.value
|
126
|
+
rescue RemoteCommandError => error
|
127
|
+
log.warn "Examine command on #{error.host} failed"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
job.report_success("Completed on #{nodes.length} nodes.")
|
131
|
+
ensure
|
132
|
+
job.terminate if job && job.alive?
|
133
|
+
end
|
134
|
+
|
106
135
|
# Find an environment on the remote Chef server
|
107
136
|
#
|
108
137
|
# @param [#to_s] id
|
@@ -183,7 +212,7 @@ module MotherBrain
|
|
183
212
|
#
|
184
213
|
# @return [Array(Ridley::NodeObject)]
|
185
214
|
def nodes_for_environment(name)
|
186
|
-
ridley.
|
215
|
+
ridley.partial_search(:node, "chef_environment:#{name}", ["fqdn", "cloud.public_hostname", "name"])
|
187
216
|
end
|
188
217
|
|
189
218
|
private
|
data/lib/mb/version.rb
CHANGED
data/motherbrain.gemspec
CHANGED
@@ -33,7 +33,6 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.name = "motherbrain"
|
34
34
|
s.require_paths = ["lib"]
|
35
35
|
s.version = MotherBrain::VERSION
|
36
|
-
s.required_ruby_version = ">= 2.0.0"
|
37
36
|
|
38
37
|
s.add_dependency 'celluloid', '~> 0.15'
|
39
38
|
# s.add_dependency 'dcell', '~> 0.14.0'
|
@@ -43,7 +42,7 @@ Gem::Specification.new do |s|
|
|
43
42
|
s.add_dependency 'net-ssh'
|
44
43
|
s.add_dependency 'net-sftp'
|
45
44
|
s.add_dependency 'solve', '>= 0.4.4'
|
46
|
-
s.add_dependency 'ridley-connectors', '~> 1.
|
45
|
+
s.add_dependency 'ridley-connectors', '~> 1.6.0'
|
47
46
|
s.add_dependency 'thor', '~> 0.18.0'
|
48
47
|
s.add_dependency 'faraday', '< 0.9.0'
|
49
48
|
s.add_dependency 'faraday_middleware'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motherbrain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2014-03-
|
18
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: celluloid
|
@@ -121,14 +121,14 @@ dependencies:
|
|
121
121
|
requirements:
|
122
122
|
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.6.0
|
125
125
|
type: :runtime
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: 1.6.0
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: thor
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -585,7 +585,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
585
585
|
requirements:
|
586
586
|
- - '>='
|
587
587
|
- !ruby/object:Gem::Version
|
588
|
-
version:
|
588
|
+
version: '0'
|
589
589
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
590
590
|
requirements:
|
591
591
|
- - '>='
|