knife-inspect 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +11 -0
- data/README.md +10 -1
- data/knife-inspect.gemspec +2 -1
- data/lib/chef/knife/inspect.rb +21 -1
- data/lib/health_inspector/checklists/base.rb +11 -4
- data/lib/health_inspector/checklists/cookbooks.rb +0 -2
- data/lib/health_inspector/checklists/data_bag_items.rb +0 -2
- data/lib/health_inspector/checklists/data_bags.rb +0 -2
- data/lib/health_inspector/checklists/environments.rb +0 -2
- data/lib/health_inspector/checklists/roles.rb +0 -2
- data/lib/health_inspector/version.rb +1 -1
- data/spec/chef/knife/inspect_spec.rb +9 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08fcbef7a39b4537d36bedc38ac1fe729de18ff7
|
4
|
+
data.tar.gz: 922b94ce6d628fd143f94bb10a1d45493575e742
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ff1db43b22fa66ce529d32e73be5de237e32f20f14dba8e4530aa204d19c4d07f8a213ab718161dffe52800490978df78c3c1bc71e9e7dbee2d42758ef1314a
|
7
|
+
data.tar.gz: 5902568d29aef45798d51fb1c8b2db44f958c616e3fb6a1a0249e9a2f547abad7e451cecc779364b68d4ac5bba81f3eda91fd2ea5871d83c72db755b8f7a930d
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 0.14.0 ( 2016-04-22 )
|
2
|
+
|
3
|
+
* New feature: Allow to deactivate inspection by component ([#34][#34]). Thanks
|
4
|
+
@kamaradclimber
|
5
|
+
|
6
|
+
```
|
7
|
+
--no-cookbooks --no-data-bags --no-data-bag-items --no-environments --no-roles
|
8
|
+
```
|
9
|
+
|
10
|
+
|
1
11
|
## 0.13.1 ( 2016-02-16 )
|
2
12
|
|
3
13
|
* Don't rely on deprecated auto-inflation of JSON data. Switch to `#from_hash`
|
@@ -189,3 +199,4 @@ instead.
|
|
189
199
|
[#23]: https://github.com/bmarini/knife-inspect/issues/23
|
190
200
|
[#35]: https://github.com/bmarini/knife-inspect/issues/35
|
191
201
|
[#42]: https://github.com/bmarini/knife-inspect/issues/42
|
202
|
+
[#34]: https://github.com/bmarini/knife-inspect/pull/34
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ or individual components.
|
|
18
18
|
|
19
19
|
knife inspect
|
20
20
|
|
21
|
-
knife cookbook inspect
|
21
|
+
knife cookbook inspect [--no-cookbooks --no-data-bags --no-data-bag-items --no-environments --no-roles]
|
22
22
|
knife cookbook inspect [COOKBOOK]
|
23
23
|
|
24
24
|
knife data bag inspect
|
@@ -45,6 +45,15 @@ So far it checks if...
|
|
45
45
|
* your environments are in sync
|
46
46
|
* your roles are in sync
|
47
47
|
|
48
|
+
You can use the option switches to disable checking for a resource type when
|
49
|
+
running `knife inspect`:
|
50
|
+
|
51
|
+
* `--no-cookbooks`
|
52
|
+
* `--no-data-bags`
|
53
|
+
* `--no-data-bag-items`
|
54
|
+
* `--no-environments`
|
55
|
+
* `--no-roles`
|
56
|
+
|
48
57
|
You can use it with your favorite Continuous Integration tool, it returns 0
|
49
58
|
when everything is in sync or 1 if it's not.
|
50
59
|
|
data/knife-inspect.gemspec
CHANGED
@@ -30,5 +30,6 @@ Gem::Specification.new do |s|
|
|
30
30
|
|
31
31
|
s.add_runtime_dependency 'chef', chef_version
|
32
32
|
s.add_runtime_dependency 'yajl-ruby', '~> 1.2'
|
33
|
-
s.add_runtime_dependency 'parallel',
|
33
|
+
s.add_runtime_dependency 'parallel', '~> 1.3'
|
34
|
+
s.add_runtime_dependency 'inflecto', '~> 0.0.2'
|
34
35
|
end
|
data/lib/chef/knife/inspect.rb
CHANGED
@@ -13,13 +13,33 @@ class Chef
|
|
13
13
|
|
14
14
|
banner 'knife inspect'
|
15
15
|
|
16
|
+
CHECKLISTS.each do |checklist|
|
17
|
+
checklist = HealthInspector::Checklists.const_get(checklist)
|
18
|
+
|
19
|
+
option checklist.option,
|
20
|
+
:long => "--[no-]#{checklist.option}",
|
21
|
+
:boolean => true,
|
22
|
+
:default => true,
|
23
|
+
:description => "Add or exclude #{checklist.title} from inspection"
|
24
|
+
end
|
25
|
+
|
16
26
|
def run
|
17
|
-
results =
|
27
|
+
results = checklists_to_run.map do |checklist|
|
18
28
|
HealthInspector::Checklists.const_get(checklist).run(self)
|
19
29
|
end
|
20
30
|
|
21
31
|
exit !results.include?(false)
|
22
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def checklists_to_run
|
37
|
+
CHECKLISTS.select do |checklist|
|
38
|
+
checklist = HealthInspector::Checklists.const_get(checklist)
|
39
|
+
|
40
|
+
config[checklist.option]
|
41
|
+
end
|
42
|
+
end
|
23
43
|
end
|
24
44
|
end
|
25
45
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'pathname'
|
3
3
|
require 'yajl'
|
4
4
|
require 'parallel'
|
5
|
+
require 'inflecto'
|
5
6
|
|
6
7
|
module HealthInspector
|
7
8
|
module Checklists
|
@@ -9,10 +10,8 @@ module HealthInspector
|
|
9
10
|
include Color
|
10
11
|
|
11
12
|
class << self
|
12
|
-
|
13
|
-
|
14
|
-
def title(val = nil)
|
15
|
-
val.nil? ? @title : @title = val
|
13
|
+
def title
|
14
|
+
Inflecto.humanize(underscored_class).downcase
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
@@ -20,6 +19,14 @@ module HealthInspector
|
|
20
19
|
new(knife).run
|
21
20
|
end
|
22
21
|
|
22
|
+
def self.option
|
23
|
+
Inflecto.dasherize(underscored_class).to_sym
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.underscored_class
|
27
|
+
Inflecto.underscore(Inflecto.demodulize(self.to_s))
|
28
|
+
end
|
29
|
+
|
23
30
|
def initialize(knife)
|
24
31
|
@context = Context.new(knife)
|
25
32
|
end
|
@@ -15,6 +15,15 @@ RSpec.describe Chef::Knife::Inspect do
|
|
15
15
|
knife_inspect.run
|
16
16
|
end
|
17
17
|
|
18
|
+
before do
|
19
|
+
# FIXME: Default config does not appear to be used by Chef 11 & 12
|
20
|
+
described_class::CHECKLISTS.each do |checklist|
|
21
|
+
checklist = HealthInspector::Checklists.const_get(checklist)
|
22
|
+
|
23
|
+
knife_inspect.config[checklist.option] = true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
18
27
|
context 'when all the checklists pass' do
|
19
28
|
it 'runs all the check lists and exits with 0' do
|
20
29
|
{ HealthInspector::Checklists::Cookbooks => true,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-inspect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Karékinian
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '1.3'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: inflecto
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.0.2
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.0.2
|
112
126
|
description: knife-inspect is a knife plugin to compare the content of your Chef repository
|
113
127
|
and Chef server
|
114
128
|
email:
|