puppet-ghostbuster 0.9.0 → 1.2.0

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.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +17 -0
  3. data/.github/workflows/release.yml +33 -0
  4. data/.github/workflows/test.yml +57 -0
  5. data/.gitignore +5 -4
  6. data/.rubocop.yml +8 -0
  7. data/.rubocop_todo.yml +173 -0
  8. data/CHANGELOG.md +226 -95
  9. data/Gemfile +13 -1
  10. data/README.md +20 -5
  11. data/Rakefile +31 -9
  12. data/lib/puppet-ghostbuster/puppetdb.rb +35 -9
  13. data/lib/puppet-ghostbuster/util.rb +19 -0
  14. data/lib/puppet-ghostbuster/version.rb +1 -1
  15. data/lib/puppet-lint/plugins/check_ghostbuster_classes.rb +4 -4
  16. data/lib/puppet-lint/plugins/check_ghostbuster_defines.rb +4 -5
  17. data/lib/puppet-lint/plugins/check_ghostbuster_facts.rb +21 -19
  18. data/lib/puppet-lint/plugins/check_ghostbuster_files.rb +11 -10
  19. data/lib/puppet-lint/plugins/check_ghostbuster_functions.rb +9 -8
  20. data/lib/puppet-lint/plugins/check_ghostbuster_hiera_files.rb +45 -33
  21. data/lib/puppet-lint/plugins/check_ghostbuster_templates.rb +14 -11
  22. data/lib/puppet-lint/plugins/check_ghostbuster_types.rb +4 -4
  23. data/puppet-ghostbuster.gemspec +21 -19
  24. data/spec/fixtures/hiera.yaml +17 -12
  25. data/spec/fixtures/modules/foo/lib/facter/asym.rb +8 -0
  26. data/spec/fixtures/modules/foo/lib/facter/bar.rb +2 -0
  27. data/spec/fixtures/modules/foo/lib/facter/baz.rb +2 -0
  28. data/spec/fixtures/modules/foo/lib/facter/foo.rb +2 -0
  29. data/spec/fixtures/modules/foo/lib/facter/multi.rb +2 -0
  30. data/spec/fixtures/modules/foo/lib/facter/quux.rb +2 -0
  31. data/spec/fixtures/modules/foo/lib/puppet/parser/functions/bar.rb +8 -2
  32. data/spec/fixtures/modules/foo/lib/puppet/parser/functions/baz.rb +8 -2
  33. data/spec/fixtures/modules/foo/lib/puppet/parser/functions/foo.rb +8 -2
  34. data/spec/fixtures/modules/foo/lib/puppet/parser/functions/quux.rb +8 -2
  35. data/spec/fixtures/modules/foo/lib/puppet/type/bar.rb +2 -0
  36. data/spec/fixtures/modules/foo/lib/puppet/type/foo.rb +2 -0
  37. data/spec/puppet-lint/plugins/ghostbuster_classes_spec.rb +10 -9
  38. data/spec/puppet-lint/plugins/ghostbuster_defines_spec.rb +11 -11
  39. data/spec/puppet-lint/plugins/ghostbuster_facts_spec.rb +33 -20
  40. data/spec/puppet-lint/plugins/ghostbuster_files_spec.rb +25 -25
  41. data/spec/puppet-lint/plugins/ghostbuster_functions_spec.rb +16 -15
  42. data/spec/puppet-lint/plugins/ghostbuster_hiera_files_spec.rb +54 -30
  43. data/spec/puppet-lint/plugins/ghostbuster_templates_spec.rb +17 -16
  44. data/spec/puppet-lint/plugins/ghostbuster_types_spec.rb +10 -9
  45. data/spec/spec_helper.rb +34 -34
  46. metadata +78 -36
  47. data/.travis.yml +0 -20
data/CHANGELOG.md CHANGED
@@ -1,189 +1,320 @@
1
- # Change Log
1
+ # Changelog
2
2
 
3
- ## [0.9.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.9.0) (2017-08-18)
4
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.8.0...0.9.0)
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.2.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/1.2.0) (2024-01-29)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/1.1.0...1.2.0)
5
8
 
6
9
  **Implemented enhancements:**
7
10
 
8
- - Use PQL queries to filter out deactivated nodes
9
- - Cache known resources
10
- - Build on Ruby 2.3.1
11
+ - Support facts by symbol [\#87](https://github.com/voxpupuli/puppet-ghostbuster/pull/87) ([h0tw1r3](https://github.com/h0tw1r3))
12
+ - support for hiera datadir [\#86](https://github.com/voxpupuli/puppet-ghostbuster/pull/86) ([h0tw1r3](https://github.com/h0tw1r3))
13
+ - optimize puppetdb query [\#85](https://github.com/voxpupuli/puppet-ghostbuster/pull/85) ([h0tw1r3](https://github.com/h0tw1r3))
14
+ - optimize search file content [\#84](https://github.com/voxpupuli/puppet-ghostbuster/pull/84) ([h0tw1r3](https://github.com/h0tw1r3))
15
+ - support puppetdb token authentication [\#73](https://github.com/voxpupuli/puppet-ghostbuster/pull/73) ([h0tw1r3](https://github.com/h0tw1r3))
16
+
17
+ **Fixed bugs:**
11
18
 
12
- ## [0.8.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.8.0) (2016-09-23)
13
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.7.3...0.8.0)
19
+ - Getting 'ArgumentError: invalid byte sequence in UTF-8' when using ghostbuster\_facts [\#63](https://github.com/voxpupuli/puppet-ghostbuster/issues/63)
14
20
 
15
- **Implemented enhancements:**
21
+ **Merged pull requests:**
22
+
23
+ - Update voxpupuli-rubocop requirement from ~\> 2.3.0 to ~\> 2.4.0 [\#82](https://github.com/voxpupuli/puppet-ghostbuster/pull/82) ([dependabot[bot]](https://github.com/apps/dependabot))
24
+ - Update voxpupuli-rubocop requirement from ~\> 2.2.0 to ~\> 2.3.0 [\#81](https://github.com/voxpupuli/puppet-ghostbuster/pull/81) ([dependabot[bot]](https://github.com/apps/dependabot))
25
+
26
+ ## [1.1.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/1.1.0) (2024-01-08)
27
+
28
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/1.0.0...1.1.0)
29
+
30
+ Due to problems during the migration from the camptocamp GitHub org to Vox Pupuli we had some issues with the v1.0.0 Release. The tag exists but the release isn't available on rubygems.org.
31
+
32
+ **Merged pull requests:**
33
+
34
+ - reorder gems in Gemfile/gemspec [\#78](https://github.com/voxpupuli/puppet-ghostbuster/pull/78) ([bastelfreak](https://github.com/bastelfreak))
35
+ - Set minimal Ruby version to 2.7 [\#77](https://github.com/voxpupuli/puppet-ghostbuster/pull/77) ([bastelfreak](https://github.com/bastelfreak))
36
+
37
+ ## [1.0.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/1.0.0) (2023-11-11)
38
+
39
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.9.0...1.0.0)
40
+
41
+ **Breaking changes:**
42
+
43
+ - Support hiera v5 [\#75](https://github.com/voxpupuli/puppet-ghostbuster/pull/75) ([marek130](https://github.com/marek130))
44
+
45
+ **Closed issues:**
46
+
47
+ - Can we bump this module to support puppet-lint \> 3? [\#67](https://github.com/voxpupuli/puppet-ghostbuster/issues/67)
48
+
49
+ **Merged pull requests:**
50
+
51
+ - Bump actions/checkout from 3 to 4 [\#72](https://github.com/voxpupuli/puppet-ghostbuster/pull/72) ([dependabot[bot]](https://github.com/apps/dependabot))
52
+ - added some unsafe rubocop fixes [\#71](https://github.com/voxpupuli/puppet-ghostbuster/pull/71) ([zilchms](https://github.com/zilchms))
53
+ - Update puppet-lint requirement from \>= 1.0, \< 3.0 to \>= 1.0, \< 5.0 [\#70](https://github.com/voxpupuli/puppet-ghostbuster/pull/70) ([dependabot[bot]](https://github.com/apps/dependabot))
54
+ - modulesync 2023-8-23 [\#69](https://github.com/voxpupuli/puppet-ghostbuster/pull/69) ([zilchms](https://github.com/zilchms))
55
+ - add transfer notice to README; adjust gemspec accordingly [\#68](https://github.com/voxpupuli/puppet-ghostbuster/pull/68) ([zilchms](https://github.com/zilchms))
56
+ - Use default certificate locations [\#65](https://github.com/voxpupuli/puppet-ghostbuster/pull/65) ([raphink](https://github.com/raphink))
57
+ - typo fix in the readme file [\#64](https://github.com/voxpupuli/puppet-ghostbuster/pull/64) ([Sher-Chowdhury](https://github.com/Sher-Chowdhury))
58
+
59
+ ## [0.9.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.9.0) (2017-08-18)
16
60
 
17
- - Supports Puppet-lint 2.0.
61
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.8.0...0.9.0)
18
62
 
19
- ## [0.7.3](https://rubygems.org/gems/puppet-ghostbuster/versions/0.7.3) (2016-06-08)
20
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.7.2...0.7.3)
63
+ **Merged pull requests:**
64
+
65
+ - Use PQL [\#62](https://github.com/voxpupuli/puppet-ghostbuster/pull/62) ([raphink](https://github.com/raphink))
66
+
67
+ ## [0.8.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.8.0) (2016-09-23)
68
+
69
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.7.3...0.8.0)
70
+
71
+ **Closed issues:**
72
+
73
+ - Conflicts with puppet-lint 2 [\#61](https://github.com/voxpupuli/puppet-ghostbuster/issues/61)
74
+
75
+ ## [0.7.3](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.7.3) (2016-06-08)
76
+
77
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.7.2...0.7.3)
21
78
 
22
79
  **Fixed bugs:**
23
80
 
24
- - False positive when fact is boolean
81
+ - \[Hiera\_files\] False positive when fact is boolean [\#59](https://github.com/voxpupuli/puppet-ghostbuster/issues/59)
82
+
83
+ **Merged pull requests:**
84
+
85
+ - Convert fact value to boolean \(fixes \#59\) [\#60](https://github.com/voxpupuli/puppet-ghostbuster/pull/60) ([mcanevet](https://github.com/mcanevet))
86
+
87
+ ## [0.7.2](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.7.2) (2016-05-19)
25
88
 
26
- ## [0.7.2](https://rubygems.org/gems/puppet-ghostbuster/versions/0.7.2) (2016-05-19)
27
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.7.1...0.7.2)
89
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.7.1...0.7.2)
28
90
 
29
91
  **Fixed bugs:**
30
92
 
31
- - Detect facts used in inline_templates()
93
+ - Facts used in inline\_templates are not detected [\#53](https://github.com/voxpupuli/puppet-ghostbuster/issues/53)
32
94
 
33
- ## [0.7.1](https://rubygems.org/gems/puppet-ghostbuster/versions/0.7.1) (2016-05-16)
34
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.7.0...0.7.1)
95
+ **Merged pull requests:**
35
96
 
36
- **Implemented enhancements:**
97
+ - Detect facts used in inline\_template \(fixes \#53\) [\#54](https://github.com/voxpupuli/puppet-ghostbuster/pull/54) ([mcanevet](https://github.com/mcanevet))
98
+
99
+ ## [0.7.1](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.7.1) (2016-05-16)
100
+
101
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.7.0...0.7.1)
102
+
103
+ **Merged pull requests:**
104
+
105
+ - Use puppetdb instead of manifests for unused types detection [\#52](https://github.com/voxpupuli/puppet-ghostbuster/pull/52) ([mcanevet](https://github.com/mcanevet))
37
106
 
38
- - Add missing documentation.
39
- - Use PuppetDB instead of manifests to detect unused types.
107
+ ## [0.7.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.7.0) (2016-05-16)
40
108
 
41
- ## [0.7.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.7.0) (2016-05-16)
42
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.6.0...0.7.0)
109
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.6.0...0.7.0)
43
110
 
44
111
  **Implemented enhancements:**
45
112
 
46
- - Detect unused facts.
47
- - Detect unused functions.
48
- - Detect unused types.
113
+ - Plugin to detect unused facts [\#45](https://github.com/voxpupuli/puppet-ghostbuster/issues/45)
114
+ - Plugin to detect unused types [\#44](https://github.com/voxpupuli/puppet-ghostbuster/issues/44)
115
+ - Plugin to detect unused functions [\#43](https://github.com/voxpupuli/puppet-ghostbuster/issues/43)
116
+
117
+ **Closed issues:**
118
+
119
+ - Use fixtures for puppetdb calls [\#42](https://github.com/voxpupuli/puppet-ghostbuster/issues/42)
120
+
121
+ **Merged pull requests:**
122
+
123
+ - Detect unused types \(fixes \#44\) [\#51](https://github.com/voxpupuli/puppet-ghostbuster/pull/51) ([mcanevet](https://github.com/mcanevet))
124
+ - Detect unused functions \(fixes \#43\) [\#50](https://github.com/voxpupuli/puppet-ghostbuster/pull/50) ([mcanevet](https://github.com/mcanevet))
125
+ - Use fixtures for puppetdb queries [\#49](https://github.com/voxpupuli/puppet-ghostbuster/pull/49) ([mcanevet](https://github.com/mcanevet))
126
+ - Detect unused facts \(fixes \#45\) [\#46](https://github.com/voxpupuli/puppet-ghostbuster/pull/46) ([mcanevet](https://github.com/mcanevet))
49
127
 
50
- ## [0.6.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.6.0) (2016-05-12)
51
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.5.1...0.6.0)
128
+ ## [0.6.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.6.0) (2016-05-12)
129
+
130
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.5.1...0.6.0)
52
131
 
53
132
  **Implemented enhancements:**
54
133
 
55
- - Detect unused hiera files.
134
+ - Plugin to detect unused hiera files [\#26](https://github.com/voxpupuli/puppet-ghostbuster/issues/26)
135
+
136
+ **Merged pull requests:**
137
+
138
+ - Detect unused hiera files \(fixes \#26\) [\#48](https://github.com/voxpupuli/puppet-ghostbuster/pull/48) ([mcanevet](https://github.com/mcanevet))
56
139
 
57
- ## [0.5.1](https://rubygems.org/gems/puppet-ghostbuster/versions/0.5.1) (2016-05-11)
58
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.5.0...0.5.1)
140
+ ## [0.5.1](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.5.1) (2016-05-11)
141
+
142
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.5.0...0.5.1)
143
+
144
+ **Implemented enhancements:**
145
+
146
+ - Use fixtures for unit tests [\#38](https://github.com/voxpupuli/puppet-ghostbuster/issues/38)
147
+ - Detect templates included in templates [\#37](https://github.com/voxpupuli/puppet-ghostbuster/issues/37)
59
148
 
60
149
  **Fixed bugs:**
61
150
 
62
- - Detect templates included in templates
151
+ - Module path with ending slash cause an error [\#13](https://github.com/voxpupuli/puppet-ghostbuster/issues/13)
152
+
153
+ **Closed issues:**
154
+
155
+ - non-ssl fails [\#14](https://github.com/voxpupuli/puppet-ghostbuster/issues/14)
156
+
157
+ **Merged pull requests:**
63
158
 
64
- ## [0.5.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.5.0) (2016-05-10)
65
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.4.5...0.5.0)
159
+ - Detect templates included in templates \(Fix \#37\) [\#41](https://github.com/voxpupuli/puppet-ghostbuster/pull/41) ([mcanevet](https://github.com/mcanevet))
160
+ - Add a spec lib to ease PuppetDB mocking [\#40](https://github.com/voxpupuli/puppet-ghostbuster/pull/40) ([raphink](https://github.com/raphink))
161
+ - Use fixtures [\#39](https://github.com/voxpupuli/puppet-ghostbuster/pull/39) ([mcanevet](https://github.com/mcanevet))
162
+
163
+ ## [0.5.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.5.0) (2016-05-10)
164
+
165
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.4.5...0.5.0)
66
166
 
67
167
  **Implemented enhancements:**
68
168
 
69
- - Major Reimplementation. Delivered as puppet-lint plugins.
169
+ - refactor puppet db queries \(self.client\) [\#7](https://github.com/voxpupuli/puppet-ghostbuster/issues/7)
70
170
 
71
- ## [0.4.5](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.5) (2016-05-04)
72
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.4.4...0.4.5)
171
+ **Closed issues:**
73
172
 
74
- **Fixed bugs:**
173
+ - \[File\] False positive when parent dir has recurse =\> true [\#21](https://github.com/voxpupuli/puppet-ghostbuster/issues/21)
174
+ - Fix manifests filter regex [\#33](https://github.com/voxpupuli/puppet-ghostbuster/issues/33)
175
+ - Fix warning: class variable acce ss from toplevel [\#32](https://github.com/voxpupuli/puppet-ghostbuster/issues/32)
176
+ - Refactor puppet-lint plugins [\#30](https://github.com/voxpupuli/puppet-ghostbuster/issues/30)
177
+ - Fix pending unit tests [\#29](https://github.com/voxpupuli/puppet-ghostbuster/issues/29)
178
+ - Refactor using plugins \(like puppet-lint\) [\#25](https://github.com/voxpupuli/puppet-ghostbuster/issues/25)
75
179
 
76
- - Don't use regex
180
+ **Merged pull requests:**
77
181
 
78
- ## [0.4.4](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.4) (2016-05-04)
79
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.4.3...0.4.4)
182
+ - Use a better regexp for manifests [\#34](https://github.com/voxpupuli/puppet-ghostbuster/pull/34) ([raphink](https://github.com/raphink))
183
+ - V2 refactor [\#31](https://github.com/voxpupuli/puppet-ghostbuster/pull/31) ([raphink](https://github.com/raphink))
184
+ - Use puppet-lint plugins [\#27](https://github.com/voxpupuli/puppet-ghostbuster/pull/27) ([mcanevet](https://github.com/mcanevet))
185
+ - Fix travis run \(fixes \#18\) [\#24](https://github.com/voxpupuli/puppet-ghostbuster/pull/24) ([mcanevet](https://github.com/mcanevet))
80
186
 
81
- **Fixed bugs:**
187
+ ## [0.4.5](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.4.5) (2016-05-04)
82
188
 
83
- - Fix unless/if issue
189
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.4.4...0.4.5)
84
190
 
85
- ## [0.4.3](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.3) (2016-05-04)
86
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.4.2...0.4.3)
191
+ ## [0.4.4](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.4.4) (2016-05-04)
87
192
 
88
- **Fixed bugs:**
193
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.4.3...0.4.4)
89
194
 
90
- - Less false positive
195
+ ## [0.4.3](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.4.3) (2016-05-04)
91
196
 
92
- ## [0.4.2](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.2) (2016-05-02)
93
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.4.1...0.4.2)
197
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.4.2...0.4.3)
94
198
 
95
- **Fixed bugs:**
199
+ **Merged pull requests:**
96
200
 
97
- - Fix variable name
201
+ - Resource params [\#23](https://github.com/voxpupuli/puppet-ghostbuster/pull/23) ([mcanevet](https://github.com/mcanevet))
202
+ - Implement --key, --cert and --ca options [\#22](https://github.com/voxpupuli/puppet-ghostbuster/pull/22) ([Phil0xF7](https://github.com/Phil0xF7))
98
203
 
99
- ## [0.4.1](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.1) (2016-05-02)
100
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.4.0...0.4.1)
204
+ ## [0.4.2](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.4.2) (2016-05-02)
101
205
 
102
- **Fixed bugs:**
206
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.4.1...0.4.2)
103
207
 
104
- - Fix unused files detection[\#20](https://github.com/camptocamp/puppet-ghostbuster/pull/20) ([mcanevet](https://github.com/mcanevet))
208
+ ## [0.4.1](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.4.1) (2016-05-02)
105
209
 
106
- ## [0.4.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.0) (2016-04-28)
107
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.3.0...0.4.0)
210
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.4.0...0.4.1)
108
211
 
109
- **Implemented enhancements:**
212
+ **Merged pull requests:**
213
+
214
+ - Fix unused files detection [\#20](https://github.com/voxpupuli/puppet-ghostbuster/pull/20) ([mcanevet](https://github.com/mcanevet))
110
215
 
111
- - Output to JSON[\#17](https://github.com/camptocamp/puppet-ghostbuster/pull/17) ([mcanevet](https://github.com/mcanevet))
216
+ ## [0.4.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.4.0) (2016-04-28)
112
217
 
113
- ## [0.3.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.3.0) (2016-04-26)
114
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.2.1...0.3.0)
218
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.2.1...0.4.0)
219
+
220
+ **Implemented enhancements:**
221
+
222
+ - Output to json [\#17](https://github.com/voxpupuli/puppet-ghostbuster/issues/17)
115
223
 
116
224
  **Fixed bugs:**
117
225
 
118
- - PuppetDB 3+ support [\#16](https://github.com/camptocamp/puppet-ghostbuster/pull/16) ([daenney](https://github.com/daenney))
226
+ - Fix unit tests [\#18](https://github.com/voxpupuli/puppet-ghostbuster/issues/18)
227
+
228
+ **Closed issues:**
229
+
230
+ - PuppetDB 3+ support [\#15](https://github.com/voxpupuli/puppet-ghostbuster/issues/15)
119
231
 
120
- ## [0.2.1](https://rubygems.org/gems/puppet-ghostbuster/versions/0.2.1) (2015-10-07)
121
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.2.0...0.2.1)
232
+ **Merged pull requests:**
233
+
234
+ - Output to JSON \(fixes \#17\) [\#19](https://github.com/voxpupuli/puppet-ghostbuster/pull/19) ([mcanevet](https://github.com/mcanevet))
235
+ - Configure client for PuppetDB API v4 [\#16](https://github.com/voxpupuli/puppet-ghostbuster/pull/16) ([daenney](https://github.com/daenney))
236
+
237
+ ## [0.2.1](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.2.1) (2015-10-07)
238
+
239
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.2.0...0.2.1)
122
240
 
123
241
  **Fixed bugs:**
124
242
 
125
- - Add documentation and allow relative paths in .ghostbusterignore file [\#12](https://github.com/camptocamp/puppet-ghostbuster/pull/12) ([roidelapluie](https://github.com/roidelapluie))
243
+ - Add documentation and allow relative paths in .ghostbusterignore file [\#12](https://github.com/voxpupuli/puppet-ghostbuster/pull/12) ([roidelapluie](https://github.com/roidelapluie))
126
244
 
127
- ## [0.2.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.2.0) (2015-10-07)
128
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.1.4...0.2.0)
245
+ ## [0.2.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.2.0) (2015-10-07)
246
+
247
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.1.4...0.2.0)
129
248
 
130
249
  **Implemented enhancements:**
131
250
 
132
- - Implement a .ghostbusterignore file [\#11](https://github.com/camptocamp/puppet-ghostbuster/pull/11) ([roidelapluie](https://github.com/roidelapluie))
251
+ - Implement a .ghostbusterignore file [\#11](https://github.com/voxpupuli/puppet-ghostbuster/pull/11) ([roidelapluie](https://github.com/roidelapluie))
252
+
253
+ ## [0.1.4](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.1.4) (2015-09-14)
133
254
 
134
- ## [0.1.4](https://rubygems.org/gems/puppet-ghostbuster/versions/0.1.4) (2015-09-14)
135
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.1.3...0.1.4)
255
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.1.3...0.1.4)
136
256
 
137
257
  **Implemented enhancements:**
138
258
 
139
- - Setup automatic releases on Travis CI [\#9](https://github.com/camptocamp/puppet-ghostbuster/issues/9)
259
+ - Setup automatic releases on Travis CI [\#9](https://github.com/voxpupuli/puppet-ghostbuster/issues/9)
140
260
 
141
261
  **Fixed bugs:**
142
262
 
143
- - Skip symlink files [\#10](https://github.com/camptocamp/puppet-ghostbuster/issues/10)
144
- - Search for files in all subfolders [\#8](https://github.com/camptocamp/puppet-ghostbuster/pull/8) ([roman-mueller](https://github.com/roman-mueller))
263
+ - Skip symlink files [\#10](https://github.com/voxpupuli/puppet-ghostbuster/issues/10)
264
+ - Search for files in all subfolders [\#8](https://github.com/voxpupuli/puppet-ghostbuster/pull/8) ([roman-mueller](https://github.com/roman-mueller))
145
265
 
146
- ## [0.1.3](https://rubygems.org/gems/puppet-ghostbuster/versions/0.1.3) (2015-04-23)
147
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.1.2...0.1.3)
266
+ ## [0.1.3](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.1.3) (2015-04-23)
267
+
268
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.1.2...0.1.3)
148
269
 
149
270
  **Implemented enhancements:**
150
271
 
151
- - add @@logger and log level option [\#5](https://github.com/camptocamp/puppet-ghostbuster/pull/5) ([saimonn](https://github.com/saimonn))
272
+ - add @@logger and log level option [\#5](https://github.com/voxpupuli/puppet-ghostbuster/pull/5) ([saimonn](https://github.com/saimonn))
273
+
274
+ ## [0.1.2](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.1.2) (2015-04-23)
275
+
276
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.1.1...0.1.2)
152
277
 
153
- ## [0.1.2](https://rubygems.org/gems/puppet-ghostbuster/versions/0.1.2) (2015-04-23)
154
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.1.1...0.1.2)
278
+ ## [0.1.1](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.1.1) (2015-04-23)
155
279
 
156
- ## [0.1.1](https://rubygems.org/gems/puppet-ghostbuster/versions/0.1.1) (2015-04-23)
157
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.1.0...0.1.1)
280
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.1.0...0.1.1)
158
281
 
159
282
  **Closed issues:**
160
283
 
161
- - Add support for non SSL [\#3](https://github.com/camptocamp/puppet-ghostbuster/issues/3)
284
+ - Add support for non SSL [\#3](https://github.com/voxpupuli/puppet-ghostbuster/issues/3)
162
285
 
163
- ## [0.1.0](https://rubygems.org/gems/puppet-ghostbuster/versions/0.1.0) (2015-04-22)
164
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.0.6...0.1.0)
286
+ ## [0.1.0](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.1.0) (2015-04-22)
287
+
288
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.0.6...0.1.0)
165
289
 
166
290
  **Implemented enhancements:**
167
291
 
168
- - Options/parser [\#2](https://github.com/camptocamp/puppet-ghostbuster/pull/2) ([saimonn](https://github.com/saimonn))
292
+ - Options/parser [\#2](https://github.com/voxpupuli/puppet-ghostbuster/pull/2) ([saimonn](https://github.com/saimonn))
293
+
294
+ ## [0.0.6](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.0.6) (2015-04-22)
169
295
 
170
- ## [0.0.6](https://rubygems.org/gems/puppet-ghostbuster/versions/0.0.6) (2015-04-22)
171
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.0.5...0.0.6)
296
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.0.5...0.0.6)
172
297
 
173
- ## [0.0.5](https://rubygems.org/gems/puppet-ghostbuster/versions/0.0.5) (2015-04-22)
174
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.0.4...0.0.5)
298
+ ## [0.0.5](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.0.5) (2015-04-22)
299
+
300
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.0.4...0.0.5)
175
301
 
176
302
  **Implemented enhancements:**
177
303
 
178
- - Manage templates [\#1](https://github.com/camptocamp/puppet-ghostbuster/pull/1) ([mcanevet](https://github.com/mcanevet))
304
+ - Manage templates [\#1](https://github.com/voxpupuli/puppet-ghostbuster/pull/1) ([mcanevet](https://github.com/mcanevet))
305
+
306
+ ## [0.0.4](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.0.4) (2015-04-21)
307
+
308
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.0.2...0.0.4)
309
+
310
+ ## [0.0.2](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.0.2) (2015-04-21)
311
+
312
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0.0.1...0.0.2)
179
313
 
180
- ## [0.0.4](https://rubygems.org/gems/puppet-ghostbuster/versions/0.0.4) (2015-04-21)
181
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.0.2...0.0.4)
314
+ ## [0.0.1](https://github.com/voxpupuli/puppet-ghostbuster/tree/0.0.1) (2015-04-21)
182
315
 
183
- ## [0.0.2](https://rubygems.org/gems/puppet-ghostbuster/versions/0.0.2) (2015-04-21)
184
- [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.0.1...0.0.2)
316
+ [Full Changelog](https://github.com/voxpupuli/puppet-ghostbuster/compare/0fb67b04292525eb0b75756da85f63ad900d2cb0...0.0.1)
185
317
 
186
- ## [0.0.1](https://rubygems.org/gems/puppet-ghostbuster/versions/0.0.1) (2015-04-21)
187
318
 
188
319
 
189
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
320
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile CHANGED
@@ -1,3 +1,15 @@
1
- source ENV['GEM_SOURCE'] || "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
4
 
3
5
  gemspec
6
+
7
+ group :release do
8
+ gem 'faraday-retry', '~> 2.1', require: false
9
+ gem 'github_changelog_generator', '~> 1.16.4', require: false
10
+ end
11
+
12
+ group :coverage, optional: ENV['COVERAGE'] != 'yes' do
13
+ gem 'codecov', require: false
14
+ gem 'simplecov-console', require: false
15
+ end
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  puppet-ghostbuster
2
2
  ==================
3
3
 
4
- [![Build Status](https://img.shields.io/travis/camptocamp/puppet-ghostbuster.svg)](https://travis-ci.org/camptocamp/puppet-ghostbuster)
5
- [![Gem Version](https://img.shields.io/gem/v/puppet-ghostbuster.svg)](https://rubygems.org/gems/puppet-ghostbuster)
6
- [![Gem Downloads](https://img.shields.io/gem/dt/puppet-ghostbuster.svg)](https://rubygems.org/gems/puppet-ghostbuster)
7
- [![Gemnasium](https://img.shields.io/gemnasium/camptocamp/puppet-ghostbuster.svg)](https://gemnasium.com/camptocamp/puppet-ghostbuster)
4
+ [![License](https://img.shields.io/github/license/voxpupuli/puppet-ghostbuster.svg)](https://github.com/voxpupuli/puppet-ghostbuster/blob/master/LICENSE)
5
+ [![Test](https://github.com/voxpupuli/puppet-ghostbuster/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/puppet-ghostbuster/actions/workflows/test.yml)
6
+ [![Release](https://github.com/voxpupuli/puppet-ghostbuster/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-ghostbuster/actions/workflows/release.yml)
7
+ [![RubyGem Version](https://img.shields.io/gem/v/puppet-ghostbuster.svg)](https://rubygems.org/gems/puppet-ghostbuster)
8
+ [![RubyGem Downloads](https://img.shields.io/gem/dt/puppet-ghostbuster.svg)](https://rubygems.org/gems/puppet-ghostbuster)
9
+ [![Donated by Camptocamp](https://img.shields.io/badge/donated%20by-camptocamp-fb7047.svg)](#transfer-notice)
8
10
 
9
11
  When you have dead puppet code hanging around ...
10
12
  *Who you gonna call ?*
@@ -44,6 +46,11 @@ An SSL certificate signed by your site’s Puppet CA
44
46
 
45
47
  The private key for that certificate
46
48
 
49
+ ### PE_TOKEN
50
+
51
+ If set, PE token authentication will be used instead of certificate authentication.
52
+ Value may be a token _or_ path to a file containing a token.
53
+
47
54
  Plugins
48
55
  -------
49
56
 
@@ -63,7 +70,7 @@ Find unused facts in Puppet manifests and templates.
63
70
 
64
71
  Find unused files in PuppetDB or in Puppet manifests.
65
72
 
66
- ### ghsotbuster_functions
73
+ ### ghostbuster_functions
67
74
 
68
75
  Find unused functions in Puppet manifests or templates.
69
76
 
@@ -95,3 +102,11 @@ $ find . -type f -exec puppet-lint --only-checks ghostbuster_classes,ghostbuster
95
102
  ./modules/foo/files/bar.txt - WARNING: File foo/bar.txt seems unused on line 1
96
103
  ./modules/foo/files/baz.txt - WARNING: File foo/baz.txt seems unused on line 1
97
104
  ```
105
+
106
+ ## Transfer Notice
107
+
108
+ This plugin was originally authored by [Camptocamp](http://www.camptocamp.com).
109
+ The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
110
+ Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp.
111
+
112
+ Previously: https://github.com/camptocamp/puppet-ghostbuster
data/Rakefile CHANGED
@@ -1,14 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: :spec
8
+
1
9
  begin
2
- require 'rspec/core/rake_task'
3
- RSpec::Core::RakeTask.new(:spec)
10
+ require 'rubygems'
11
+ require 'github_changelog_generator/task'
4
12
  rescue LoadError
13
+ # github-changelog-generator is an optional group
14
+ else
15
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
16
+ config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
17
+ config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog modulesync]
18
+ config.user = 'voxpupuli'
19
+ config.project = 'puppet-ghostbuster'
20
+ config.future_release = Gem::Specification.load("#{config.project}.gemspec").version
21
+ end
5
22
  end
6
23
 
7
- require 'github_changelog_generator/task'
8
- require 'puppet-ghostbuster/version'
9
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
10
- config.future_release = PuppetGhostbuster::VERSION
11
- config.release_url = "https://rubygems.org/gems/puppet-ghostbuster/versions/%s"
12
- end
24
+ begin
25
+ require 'rubocop/rake_task'
26
+ rescue LoadError
27
+ # RuboCop is an optional group
28
+ else
29
+ RuboCop::RakeTask.new(:rubocop) do |task|
30
+ # These make the rubocop experience maybe slightly less terrible
31
+ task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
13
32
 
14
- task :default => :spec
33
+ # Use Rubocop's Github Actions formatter if possible
34
+ task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
35
+ end
36
+ end
@@ -1,16 +1,37 @@
1
1
  require 'puppetdb'
2
+ require 'puppet'
2
3
 
3
4
  class PuppetGhostbuster
4
5
  class PuppetDB
6
+ Puppet.initialize_settings
7
+
8
+ begin
9
+ require 'puppet/util/puppetdb'
10
+ @@puppetdb = Puppet::Util::Puppetdb.config.server_urls[0]
11
+ rescue LoadError
12
+ @@puppetdb = "https://#{Puppet[:server]}:8081"
13
+ end
14
+
5
15
  def self.client
6
- @@client ||= ::PuppetDB::Client.new({
7
- :server => "#{ENV['PUPPETDB_URL'] || 'http://puppetdb:8080'}",
8
- :pem => {
9
- 'key' => ENV['PUPPETDB_KEY_FILE'],
10
- 'cert' => ENV['PUPPETDB_CERT_FILE'],
11
- 'ca_file' => ENV['PUPPETDB_CACERT_FILE'],
16
+ @@client ||= begin
17
+ options = {
18
+ server: ENV['PUPPETDB_URL'] || @@puppetdb,
12
19
  }
13
- }, 4)
20
+
21
+ if ENV['PE_TOKEN']
22
+ token_file = File.expand_path(ENV['PE_TOKEN'])
23
+ options[:token] = File.exist?(token_file) ? File.read(token_file) : ENV.fetch('PE_TOKEN')
24
+ options[:cacert] = ENV['PUPPETDB_CACERT_FILE'] || Puppet[:localcacert]
25
+ else
26
+ options[:pem] = {
27
+ 'key' => ENV['PUPPETDB_KEY_FILE'] || Puppet[:hostprivkey],
28
+ 'cert' => ENV['PUPPETDB_CERT_FILE'] || Puppet[:hostcert],
29
+ 'ca_file' => ENV['PUPPETDB_CACERT_FILE'] || Puppet[:localcacert],
30
+ }
31
+ end
32
+
33
+ ::PuppetDB::Client.new(options, 4)
34
+ end
14
35
  end
15
36
 
16
37
  def client
@@ -18,7 +39,10 @@ class PuppetGhostbuster
18
39
  end
19
40
 
20
41
  def self.classes
21
- @@classes ||= client.request('', 'resources[title] { type = "Class" and nodes { deactivated is null } }').data.map { |r| r['title'] }.uniq
42
+ @@classes ||= client.request('',
43
+ 'resources[title] { type = "Class" and nodes { deactivated is null } group by title }').data.map do |r|
44
+ r['title']
45
+ end
22
46
  end
23
47
 
24
48
  def classes
@@ -26,7 +50,9 @@ class PuppetGhostbuster
26
50
  end
27
51
 
28
52
  def self.resources
29
- @@resources ||= client.request('', 'resources[type] { nodes { deactivated is null } }').data.map { |r| r['type'] }.uniq
53
+ @@resources ||= client.request('', 'resources[type] { nodes { deactivated is null } group by type }').data.map do |r|
54
+ r['type']
55
+ end
30
56
  end
31
57
 
32
58
  def resources
@@ -0,0 +1,19 @@
1
+ class PuppetGhostbuster
2
+ class Util
3
+ class << self
4
+ def search_file(name, search)
5
+ return search_file_regexp(name, search) if search.is_a?(Regexp)
6
+
7
+ File.foreach(name) do |line|
8
+ return true if line.include?(search)
9
+ end
10
+ end
11
+
12
+ def search_file_regexp(name, search)
13
+ File.foreach(name) do |line|
14
+ return true if line.match?(search)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  class PuppetGhostbuster
2
- VERSION = '0.9.0'
2
+ VERSION = '1.2.0'
3
3
  end