puppet-ghostbuster 0.7.0 → 0.7.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f4d56b90b0f6e22a0f28b01e5ca1bdccc3c3bcc
4
- data.tar.gz: 75c739ec623682f6eb850ad7559126b67ef7a676
3
+ metadata.gz: a78a0b11c9950a7bd0ee29f97d952fa7fedcf1ac
4
+ data.tar.gz: 9063dd63354c9ee624e9337d155c800a7391bf03
5
5
  SHA512:
6
- metadata.gz: 1a49b28f9dfe55668e828d06f05f0c564718c13ffa913c28318445c17f701d861e5da4a3d2daecd94320c2702fbea8bd5affac28d9cd189e877af8ae83ebd50d
7
- data.tar.gz: d040b8d124939e48574cabd486f625bda849216e6fd9e6bc461080fde2cfd02abb16dba06f519f9c2ed4a55d258637013f28267842b26aa9cf7e14c86c09d24b
6
+ metadata.gz: cf75180a7a7f695c88b81bf72d703064805e539bf59dca5445fe8cb9257ef23012a7f9ed47d667fd0f16d56e1b3f578f7adb0c070837ec517aa838d6c97f12db
7
+ data.tar.gz: a3f9e6efcfe9d34f1e050e5721b61cc6d771a1d77db627c27f022e24c6e73bde4ed46be15c9345ca11f647d3d574a5a1192056e18489c70ea350f3eaaafbf162
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## [0.7.1](https://rubygems.org/gems/puppet-ghostbuster/versions/0.7.1) (2016-05-16)
4
+ [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.7.0...0.7.1)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Add missing documentation.
9
+ - Use PuppetDB instead of manifests to detect unused types.
10
+
3
11
  ## [0.7.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.7.0) (2016-05-16)
4
12
  [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.6.0...0.7.0)
5
13
 
data/README.md CHANGED
@@ -18,7 +18,7 @@ Usage
18
18
  -----
19
19
 
20
20
  ```shell
21
- $ find . -type f -exec puppet-lint --only-checks ghostbuster_classes,ghostbuster_defines,ghostbuster_files,ghostbuster_hiera_files,ghostbuster_templates {} \+
21
+ $ find . -type f -exec puppet-lint --only-checks ghostbuster_classes,ghostbuster_defines,ghostbuster_facts,ghostbuster_files,ghostbuster_functions,ghostbuster_hiera_files,ghostbuster_templates,ghostbuster_types {} \+
22
22
  ```
23
23
 
24
24
  Environment variables
@@ -55,10 +55,18 @@ Find unused classes in PuppetDB.
55
55
 
56
56
  Find unused defined types in PuppetDB.
57
57
 
58
+ ### ghostbuster_facts
59
+
60
+ Find unused facts in Puppet manifests and templates.
61
+
58
62
  ### ghostbuster_files
59
63
 
60
64
  Find unused files in PuppetDB or in Puppet manifests.
61
65
 
66
+ ### ghsotbuster_functions
67
+
68
+ Find unused functions in Puppet manifests or templates.
69
+
62
70
  ### ghostbuster_hiera_files
63
71
 
64
72
  Find unused hiera files in PuppetDB.
@@ -67,6 +75,10 @@ Find unused hiera files in PuppetDB.
67
75
 
68
76
  Find unused templates in Puppet manifests.
69
77
 
78
+ ### ghostbuster_types
79
+
80
+ Find unused types in Puppet manifests.
81
+
70
82
  Example output
71
83
  --------------
72
84
 
@@ -1,3 +1,3 @@
1
1
  class PuppetGhostbuster
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
@@ -1,3 +1,5 @@
1
+ require 'puppet-ghostbuster/puppetdb'
2
+
1
3
  PuppetLint.new_check(:ghostbuster_types) do
2
4
  def manifests
3
5
  Dir.glob('./**/manifests/**/*.pp')
@@ -9,9 +11,8 @@ PuppetLint.new_check(:ghostbuster_types) do
9
11
 
10
12
  type_name = m.captures[0]
11
13
 
12
- manifests.each do |manifest|
13
- return if File.readlines(manifest).grep(%r{^\s*#{type_name}\s*\{}).size > 0
14
- end
14
+ puppetdb = PuppetGhostbuster::PuppetDB.new
15
+ return if puppetdb.client.request('resources', [:'=', 'type', type_name.capitalize]).data.size > 0
15
16
 
16
17
  notify :warning, {
17
18
  :message => "Type #{type_name.capitalize} seems unused",
@@ -1,9 +1,6 @@
1
1
  [
2
2
  {
3
- "type": "Foo"
4
- },
5
- {
6
- "type": "Foo::Foo"
3
+ "type": "Bar::Foo"
7
4
  },
8
5
  {
9
6
  "type": "Class",
@@ -21,5 +18,8 @@
21
18
  "source": "puppet:///modules/foo/baz",
22
19
  "recurse": "true"
23
20
  }
21
+ },
22
+ {
23
+ "type": "Bar"
24
24
  }
25
25
  ]
@@ -4,25 +4,25 @@ describe 'ghostbuster_defines' do
4
4
 
5
5
  context 'with fix disabled' do
6
6
 
7
- context 'when define is used' do
8
- let(:code) { "define foo {}" }
9
- let(:path) { "./modules/foo/manifests/init.pp" }
10
-
11
- it 'should not detect any problem' do
12
- expect(problems).to have(0).problems
13
- end
14
- end
15
-
16
7
  context 'when define is not used' do
17
- let(:code) { "define bar {}" }
18
- let(:path) { "./modules/bar/manifests/init.pp" }
8
+ let(:code) { "define foo::foo {}" }
9
+ let(:path) { "./modules/foo/manifests/foo.pp" }
19
10
 
20
11
  it 'should detect one problem' do
21
12
  expect(problems).to have(1).problems
22
13
  end
23
14
 
24
15
  it 'should create a warning' do
25
- expect(problems).to contain_warning('Define Bar seems unused')
16
+ expect(problems).to contain_warning('Define Foo::Foo seems unused')
17
+ end
18
+ end
19
+
20
+ context 'when define is used' do
21
+ let(:code) { "define bar::foo {}" }
22
+ let(:path) { "./modules/bar/manifests/foo.pp" }
23
+
24
+ it 'should not detect any problem' do
25
+ expect(problems).to have(0).problems
26
26
  end
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-ghostbuster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camptocamp