health_inspector 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +4 -0
- data/README.md +17 -8
- data/Rakefile +9 -0
- data/health_inspector.gemspec +2 -3
- data/lib/health_inspector/checklists/base.rb +5 -1
- data/lib/health_inspector/checklists/data_bag_items.rb +1 -1
- data/lib/health_inspector/version.rb +1 -1
- data/spec/chef-repo/.chef/client.pem +0 -0
- data/spec/chef-repo/.chef/knife.rb +7 -0
- data/spec/data_bag_item_spec.rb +14 -0
- data/spec/spec_helper.rb +21 -0
- metadata +37 -7
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
1
|
+
## Summary
|
2
2
|
|
3
|
-
|
3
|
+
`health_inspector` is tool to inspect your chef repo as it compares to what is
|
4
|
+
on your chef server.
|
4
5
|
|
5
6
|
## Usage
|
6
7
|
|
@@ -9,12 +10,20 @@ A tool to inspect your chef repo as is compares to what is on your chef server
|
|
9
10
|
|
10
11
|
Run `health_inspector help` for more options
|
11
12
|
|
12
|
-
## What
|
13
|
+
## What it does
|
13
14
|
|
14
15
|
So far it checks if...
|
15
16
|
|
16
|
-
* your
|
17
|
-
*
|
18
|
-
|
19
|
-
* you have
|
20
|
-
|
17
|
+
* your cookbooks are in sync
|
18
|
+
* you have uncommitted changes in a cookbook (assuming your cookbooks are in
|
19
|
+
their own git repos)
|
20
|
+
* you have commits in a cookbook that haven't been pushed to your remote
|
21
|
+
(assuming your cookbooks are in their own git repos)
|
22
|
+
* your data bags are in sync
|
23
|
+
* your data bag items are in sync
|
24
|
+
* your environments are in sync
|
25
|
+
* your roles are in sync
|
26
|
+
|
27
|
+
## Assumptions
|
28
|
+
|
29
|
+
* Your roles and environments are written using the ruby DSL.
|
data/Rakefile
CHANGED
data/health_inspector.gemspec
CHANGED
@@ -18,9 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
# s.add_runtime_dependency "rest-client"
|
21
|
+
s.add_development_dependency "minitest"
|
22
|
+
s.add_development_dependency "mocha"
|
24
23
|
s.add_runtime_dependency "thor"
|
25
24
|
s.add_runtime_dependency "chef"
|
26
25
|
end
|
@@ -30,7 +30,7 @@ module HealthInspector
|
|
30
30
|
banner "Inspecting #{self.class.title}"
|
31
31
|
|
32
32
|
items.each do |item|
|
33
|
-
failures =
|
33
|
+
failures = run_checks(item)
|
34
34
|
|
35
35
|
if failures.empty?
|
36
36
|
print_success(item.name)
|
@@ -40,6 +40,10 @@ module HealthInspector
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def run_checks(item)
|
44
|
+
checks.map { |check| run_check(check, item) }.compact
|
45
|
+
end
|
46
|
+
|
43
47
|
def checks
|
44
48
|
self.class.checks
|
45
49
|
end
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "HealthInspector::Checklists::DataBagItems" do
|
4
|
+
subject do
|
5
|
+
HealthInspector::Checklists::DataBagItems.new(health_inspector_context)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should detect if a data bag item does not exist locally" do
|
9
|
+
subject.expects(:data_bag_items_on_server).returns( ["apps/app1"] )
|
10
|
+
subject.expects(:load_item_from_server).with("apps/app1").returns({})
|
11
|
+
failures = subject.run_checks(subject.items.first)
|
12
|
+
failures.first.include?("exists on server but not locally").must_equal true
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'mocha'
|
5
|
+
require 'health_inspector'
|
6
|
+
|
7
|
+
module HealthInspector::SpecHelpers
|
8
|
+
def health_inspector_context
|
9
|
+
@health_inspector_context ||= begin
|
10
|
+
repo_path = File.expand_path("../chef-repo", __FILE__)
|
11
|
+
|
12
|
+
HealthInspector::Context.new( repo_path, File.join(repo_path, ".chef/knife.rb") ).tap do |context|
|
13
|
+
context.configure
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class MiniTest::Unit::TestCase
|
20
|
+
include HealthInspector::SpecHelpers
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: health_inspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,33 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-13 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: minitest
|
16
|
+
requirement: &2154652260 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2154652260
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mocha
|
27
|
+
requirement: &2154651840 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2154651840
|
14
36
|
- !ruby/object:Gem::Dependency
|
15
37
|
name: thor
|
16
|
-
requirement: &
|
38
|
+
requirement: &2154651420 !ruby/object:Gem::Requirement
|
17
39
|
none: false
|
18
40
|
requirements:
|
19
41
|
- - ! '>='
|
@@ -21,10 +43,10 @@ dependencies:
|
|
21
43
|
version: '0'
|
22
44
|
type: :runtime
|
23
45
|
prerelease: false
|
24
|
-
version_requirements: *
|
46
|
+
version_requirements: *2154651420
|
25
47
|
- !ruby/object:Gem::Dependency
|
26
48
|
name: chef
|
27
|
-
requirement: &
|
49
|
+
requirement: &2154650960 !ruby/object:Gem::Requirement
|
28
50
|
none: false
|
29
51
|
requirements:
|
30
52
|
- - ! '>='
|
@@ -32,7 +54,7 @@ dependencies:
|
|
32
54
|
version: '0'
|
33
55
|
type: :runtime
|
34
56
|
prerelease: false
|
35
|
-
version_requirements: *
|
57
|
+
version_requirements: *2154650960
|
36
58
|
description: A tool to inspect your chef repo as is compares to what is on your chef
|
37
59
|
server
|
38
60
|
email:
|
@@ -63,6 +85,10 @@ files:
|
|
63
85
|
- lib/health_inspector/context.rb
|
64
86
|
- lib/health_inspector/inspector.rb
|
65
87
|
- lib/health_inspector/version.rb
|
88
|
+
- spec/chef-repo/.chef/client.pem
|
89
|
+
- spec/chef-repo/.chef/knife.rb
|
90
|
+
- spec/data_bag_item_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
66
92
|
homepage: https://github.com/bmarini/health_inspector
|
67
93
|
licenses: []
|
68
94
|
post_install_message:
|
@@ -87,5 +113,9 @@ rubygems_version: 1.8.10
|
|
87
113
|
signing_key:
|
88
114
|
specification_version: 3
|
89
115
|
summary: A tool to inspect your chef repo as is compares to what is on your chef server
|
90
|
-
test_files:
|
116
|
+
test_files:
|
117
|
+
- spec/chef-repo/.chef/client.pem
|
118
|
+
- spec/chef-repo/.chef/knife.rb
|
119
|
+
- spec/data_bag_item_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
91
121
|
has_rdoc:
|