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.
@@ -0,0 +1,6 @@
1
+ # CHANGELOG for baton
2
+
3
+ ## 5.2.4
4
+
5
+ * Deprecate Chef 10. Previous versions will work with Chef 10.12.0 and
6
+ lower.
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
1
  source 'http://rubygems.org'
2
- source 'http://gems.dsci.it'
3
2
 
4
3
  gemspec
5
4
 
@@ -7,4 +6,4 @@ group :darwin do
7
6
  gem "guard-rspec", "~> 0.5.8"
8
7
  gem 'rb-fsevent', "~> 0.9.1"
9
8
  gem 'growl_notify', "~> 0.0.3"
10
- end
9
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Baton - Server Orchestration Tool
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/digital-science/baton.png)](http://travis-ci.org/digital-science/baton)
3
+ [![Build Status](https://secure.travis-ci.org/digital-science/baton.png?branch=master)](http://travis-ci.org/digital-science/baton)
4
4
 
5
5
  ## Description
6
6
 
data/Rakefile CHANGED
@@ -2,6 +2,8 @@
2
2
  require "bundler/gem_tasks"
3
3
  require "rspec/core/rake_task"
4
4
 
5
+ task :default => [:test]
6
+
5
7
  RSpec::Core::RakeTask.new(:test)
6
8
  task :test => :spec
7
9
 
@@ -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
@@ -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] << "/etc/chef/ohai_plugins"
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
@@ -1,3 +1,3 @@
1
1
  module Baton
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -2,57 +2,74 @@ require "spec_helper"
2
2
  require "baton/server"
3
3
 
4
4
  describe Baton::Server do
5
- before(:each) do
6
- Ohai::System.any_instance.stub(:all_plugins).and_return(true)
7
- Ohai::System.any_instance.stub(:data).and_return({
8
- "chef_environment" => "production",
9
- "fqdn" => "build-prod-i-722b0004.dsci.it",
10
- "trebuchet" => ["octobutler"]
11
- })
12
- end
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
- describe "#configure" do
15
- context "given data from Ohai" do
15
+ describe "#configure" do
16
+ context "given data from Ohai" do
16
17
 
17
- it "will set the fqdn" do
18
- subject.fqdn.should eq("build-prod-i-722b0004.dsci.it")
19
- end
18
+ it "will set the fqdn" do
19
+ subject.fqdn.should eq("build-prod-i-722b0004.dsci.it")
20
+ end
20
21
 
21
- it "will set the environment" do
22
- subject.environment.should eq("production")
23
- end
22
+ it "will set the environment" do
23
+ subject.environment.should eq("production")
24
+ end
24
25
 
25
- it "will set the apps" do
26
- subject.app_names.first.should eq("octobutler")
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
- context "given the required facts are not available" do
31
- before(:each) do
32
- Baton::Server.any_instance.stub(:facts).and_return({})
33
- subject.configure
34
- end
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
- it "will default the fqdn to an empty string" do
37
- subject.fqdn.should be_empty
38
- end
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
- it "will default environment to development" do
41
- subject.environment.should eq("development")
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
- it "will default apps to an empty array" do
45
- subject.app_names.should be_empty
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
- describe "#attributes" do
51
- context "given an instance of a server" do
52
- it "should have the attributes set" do
53
- subject.attributes.should eq({:environment=>"production",
54
- :fqdn=>"build-prod-i-722b0004.dsci.it",
55
- :app_names=>["octobutler"]})
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
@@ -0,0 +1,8 @@
1
+ log_level :info
2
+ log_location STDOUT
3
+ ssl_verify_mode :verify_none
4
+ file_cache_path "/var/cache/chef"
5
+ file_backup_path "/var/lib/chef/backup"
6
+ pid_file "/var/run/chef/client.pid"
7
+ environment "production"
8
+
@@ -0,0 +1,5 @@
1
+ require 'chef/config'
2
+ provides 'chef_environment'
3
+
4
+ Chef::Config.from_file File.expand_path('../../etc/chef/client.rb', __FILE__)
5
+ chef_environment Chef::Config[:environment]
@@ -11,6 +11,7 @@ require "rspec/expectations"
11
11
  require 'webmock/rspec'
12
12
  require "baton/logging"
13
13
  require 'json'
14
+ require 'pry'
14
15
 
15
16
  WebMock.disable_net_connect!
16
17
 
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.2
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-01-11 00:00:00.000000000 Z
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.24
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: