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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a78a0b11c9950a7bd0ee29f97d952fa7fedcf1ac
|
4
|
+
data.tar.gz: 9063dd63354c9ee624e9337d155c800a7391bf03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,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
|
-
|
13
|
-
|
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",
|
@@ -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
|
18
|
-
let(:path) { "./modules/
|
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
|
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
|