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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ead2b16a86eea1a04e3d299fe86c2a9b4c499ff6
4
- data.tar.gz: 65647d0b7045f1ebdabc54e7073736a035cb409f
3
+ metadata.gz: 08fcbef7a39b4537d36bedc38ac1fe729de18ff7
4
+ data.tar.gz: 922b94ce6d628fd143f94bb10a1d45493575e742
5
5
  SHA512:
6
- metadata.gz: e2c6bb1c4a48e9a3098414e62298158a443f3382d65ef38f1a6a9ca093f13487a94ab8bebe269b317b3dccd78014bca13acc5bc6f17b33b88d32e9fbec430021
7
- data.tar.gz: 4ee255bb13de52a02762ffcc964664fbb17d8595ba2f6e2a48dce63bbdfdfb3da25b041c45802bd345eea8154d6f6c31a0a2f6cfc1a5439d8b78db7392d13763
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
 
@@ -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', '~> 1.3'
33
+ s.add_runtime_dependency 'parallel', '~> 1.3'
34
+ s.add_runtime_dependency 'inflecto', '~> 0.0.2'
34
35
  end
@@ -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 = CHECKLISTS.map do |checklist|
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
- attr_reader :title
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
@@ -89,8 +89,6 @@ module HealthInspector
89
89
  end
90
90
 
91
91
  class Cookbooks < Base
92
- title 'cookbooks'
93
-
94
92
  def load_item(name)
95
93
  Cookbook.new(@context,
96
94
  name: name,
@@ -9,8 +9,6 @@ module HealthInspector
9
9
  end
10
10
 
11
11
  class DataBagItems < Base
12
- title 'data bag items'
13
-
14
12
  def load_item(name)
15
13
  DataBagItem.new(@context,
16
14
  name: name,
@@ -7,8 +7,6 @@ module HealthInspector
7
7
  end
8
8
 
9
9
  class DataBags < Base
10
- title 'data bags'
11
-
12
10
  def load_item(name)
13
11
  DataBag.new(@context,
14
12
  name: name,
@@ -15,8 +15,6 @@ module HealthInspector
15
15
  end
16
16
 
17
17
  class Environments < Base
18
- title 'environments'
19
-
20
18
  def load_item(name)
21
19
  Environment.new(@context,
22
20
  name: name,
@@ -8,8 +8,6 @@ module HealthInspector
8
8
  end
9
9
 
10
10
  class Roles < Base
11
- title 'roles'
12
-
13
11
  def load_item(name)
14
12
  Role.new(@context,
15
13
  name: name,
@@ -1,3 +1,3 @@
1
1
  module HealthInspector
2
- VERSION = '0.13.1'
2
+ VERSION = '0.14.0'
3
3
  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.13.1
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-02-16 00:00:00.000000000 Z
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: