baton 0.5.2 → 0.5.4
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.
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -2
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/baton.gemspec +2 -0
- data/lib/baton/server.rb +8 -1
- data/lib/baton/version.rb +1 -1
- data/spec/baton/server_spec.rb +54 -37
- data/spec/fixtures/etc/chef/client.rb +8 -0
- data/spec/fixtures/ohai_plugins/chef_environment.rb +5 -0
- data/spec/spec_helper.rb +1 -0
- metadata +41 -9
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Baton - Server Orchestration Tool
|
2
2
|
|
3
|
-
[](http://travis-ci.org/digital-science/baton)
|
3
|
+
[](http://travis-ci.org/digital-science/baton)
|
4
4
|
|
5
5
|
## Description
|
6
6
|
|
data/Rakefile
CHANGED
data/baton.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_runtime_dependency "em-http-request", "1.0.3"
|
22
22
|
gem.add_runtime_dependency "bunny", "~> 0.8.0"
|
23
23
|
gem.add_runtime_dependency "ohai", "~> 0.6.12"
|
24
|
+
gem.add_runtime_dependency "chef", ">= 11.0"
|
24
25
|
gem.add_runtime_dependency "thor"
|
25
26
|
|
26
27
|
gem.add_development_dependency "rspec", "~> 2.7"
|
@@ -30,4 +31,5 @@ Gem::Specification.new do |gem|
|
|
30
31
|
gem.add_development_dependency "webmock", "~> 1.8.7"
|
31
32
|
gem.add_development_dependency "minitar", "0.5.3"
|
32
33
|
gem.add_development_dependency "simplecov", "0.6.4"
|
34
|
+
gem.add_development_dependency "pry"
|
33
35
|
end
|
data/lib/baton/server.rb
CHANGED
@@ -8,7 +8,7 @@ module Baton
|
|
8
8
|
# Public: Initialize a Server. ALso, configures the server by reading Baton's configuration
|
9
9
|
# file.
|
10
10
|
def initialize
|
11
|
-
Ohai::Config[:plugin_path] <<
|
11
|
+
Ohai::Config[:plugin_path] << ohai_plugin_path
|
12
12
|
@ohai = Ohai::System.new
|
13
13
|
@ohai.all_plugins
|
14
14
|
configure
|
@@ -48,5 +48,12 @@ module Baton
|
|
48
48
|
{environment: environment, fqdn: fqdn, app_names: app_names}
|
49
49
|
end
|
50
50
|
|
51
|
+
private
|
52
|
+
|
53
|
+
# Private: Path where ohai plugins are
|
54
|
+
def ohai_plugin_path
|
55
|
+
"/etc/chef/ohai_plugins"
|
56
|
+
end
|
57
|
+
|
51
58
|
end
|
52
59
|
end
|
data/lib/baton/version.rb
CHANGED
data/spec/baton/server_spec.rb
CHANGED
@@ -2,57 +2,74 @@ require "spec_helper"
|
|
2
2
|
require "baton/server"
|
3
3
|
|
4
4
|
describe Baton::Server do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
context "stubbed ohai" do
|
6
|
+
before(:each) do
|
7
|
+
Ohai::System.any_instance.stub(:all_plugins).and_return(true)
|
8
|
+
Ohai::System.any_instance.stub(:data).and_return({
|
9
|
+
"chef_environment" => "production",
|
10
|
+
"fqdn" => "build-prod-i-722b0004.dsci.it",
|
11
|
+
"trebuchet" => ["octobutler"]
|
12
|
+
})
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
describe "#configure" do
|
16
|
+
context "given data from Ohai" do
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
it "will set the fqdn" do
|
19
|
+
subject.fqdn.should eq("build-prod-i-722b0004.dsci.it")
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
it "will set the environment" do
|
23
|
+
subject.environment.should eq("production")
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
it "will set the apps" do
|
27
|
+
subject.app_names.first.should eq("octobutler")
|
28
|
+
end
|
27
29
|
end
|
28
|
-
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
context "given the required facts are not available" do
|
32
|
+
before(:each) do
|
33
|
+
Baton::Server.any_instance.stub(:facts).and_return({})
|
34
|
+
subject.configure
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
it "will default the fqdn to an empty string" do
|
38
|
+
subject.fqdn.should be_empty
|
39
|
+
end
|
40
|
+
|
41
|
+
it "will default environment to development" do
|
42
|
+
subject.environment.should eq("development")
|
43
|
+
end
|
39
44
|
|
40
|
-
|
41
|
-
|
45
|
+
it "will default apps to an empty array" do
|
46
|
+
subject.app_names.should be_empty
|
47
|
+
end
|
42
48
|
end
|
49
|
+
end
|
43
50
|
|
44
|
-
|
45
|
-
|
51
|
+
describe "#attributes" do
|
52
|
+
context "given an instance of a server" do
|
53
|
+
it "should have the attributes set" do
|
54
|
+
subject.attributes.should eq({:environment=>"production",
|
55
|
+
:fqdn=>"build-prod-i-722b0004.dsci.it",
|
56
|
+
:app_names=>["octobutler"]})
|
57
|
+
end
|
46
58
|
end
|
47
59
|
end
|
48
60
|
end
|
49
61
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
62
|
+
context "ohai integration" do
|
63
|
+
before(:each) do
|
64
|
+
ohai_fixtures = File.expand_path('../../fixtures/ohai_plugins', __FILE__)
|
65
|
+
Baton::Server.any_instance.stub(:ohai_plugin_path).and_return(ohai_fixtures)
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "#environment" do
|
69
|
+
context "production" do
|
70
|
+
it "should have the correct environment set" do
|
71
|
+
subject.environment.should eq('production')
|
72
|
+
end
|
56
73
|
end
|
57
74
|
end
|
58
75
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: amqp
|
@@ -108,6 +108,22 @@ dependencies:
|
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.6.12
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: chef
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '11.0'
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '11.0'
|
111
127
|
- !ruby/object:Gem::Dependency
|
112
128
|
name: thor
|
113
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,6 +252,22 @@ dependencies:
|
|
236
252
|
- - '='
|
237
253
|
- !ruby/object:Gem::Version
|
238
254
|
version: 0.6.4
|
255
|
+
- !ruby/object:Gem::Dependency
|
256
|
+
name: pry
|
257
|
+
requirement: !ruby/object:Gem::Requirement
|
258
|
+
none: false
|
259
|
+
requirements:
|
260
|
+
- - ! '>='
|
261
|
+
- !ruby/object:Gem::Version
|
262
|
+
version: '0'
|
263
|
+
type: :development
|
264
|
+
prerelease: false
|
265
|
+
version_requirements: !ruby/object:Gem::Requirement
|
266
|
+
none: false
|
267
|
+
requirements:
|
268
|
+
- - ! '>='
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '0'
|
239
271
|
description: Baton
|
240
272
|
email:
|
241
273
|
- johnog@gmail.com
|
@@ -248,6 +280,7 @@ files:
|
|
248
280
|
- .gitignore
|
249
281
|
- .rspec
|
250
282
|
- .travis.yml
|
283
|
+
- CHANGELOG.md
|
251
284
|
- COPYING
|
252
285
|
- Gemfile
|
253
286
|
- Guardfile
|
@@ -289,10 +322,12 @@ files:
|
|
289
322
|
- spec/baton/server_spec.rb
|
290
323
|
- spec/fixtures/config-multi.cfg
|
291
324
|
- spec/fixtures/config.cfg
|
325
|
+
- spec/fixtures/etc/chef/client.rb
|
292
326
|
- spec/fixtures/file
|
293
327
|
- spec/fixtures/file.sum
|
294
328
|
- spec/fixtures/invalid_file
|
295
329
|
- spec/fixtures/invalid_file.sum
|
330
|
+
- spec/fixtures/ohai_plugins/chef_environment.rb
|
296
331
|
- spec/spec_helper.rb
|
297
332
|
homepage: https://github.com/digital-science/baton
|
298
333
|
licenses: []
|
@@ -306,21 +341,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
306
341
|
- - ! '>='
|
307
342
|
- !ruby/object:Gem::Version
|
308
343
|
version: '0'
|
309
|
-
segments:
|
310
|
-
- 0
|
311
|
-
hash: 1528221756626291784
|
312
344
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
313
345
|
none: false
|
314
346
|
requirements:
|
315
347
|
- - ! '>='
|
316
348
|
- !ruby/object:Gem::Version
|
317
349
|
version: '0'
|
318
|
-
segments:
|
319
|
-
- 0
|
320
|
-
hash: 1528221756626291784
|
321
350
|
requirements: []
|
322
351
|
rubyforge_project:
|
323
|
-
rubygems_version: 1.8.
|
352
|
+
rubygems_version: 1.8.23
|
324
353
|
signing_key:
|
325
354
|
specification_version: 3
|
326
355
|
summary: Baton
|
@@ -333,8 +362,11 @@ test_files:
|
|
333
362
|
- spec/baton/server_spec.rb
|
334
363
|
- spec/fixtures/config-multi.cfg
|
335
364
|
- spec/fixtures/config.cfg
|
365
|
+
- spec/fixtures/etc/chef/client.rb
|
336
366
|
- spec/fixtures/file
|
337
367
|
- spec/fixtures/file.sum
|
338
368
|
- spec/fixtures/invalid_file
|
339
369
|
- spec/fixtures/invalid_file.sum
|
370
|
+
- spec/fixtures/ohai_plugins/chef_environment.rb
|
340
371
|
- spec/spec_helper.rb
|
372
|
+
has_rdoc:
|