puppet-ghostbuster 0.4.2 → 0.4.3

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: 26896fb8ebecc8062f77819d2bae90f72b858ff3
4
- data.tar.gz: 19fe3eb6c7eaa34a3868746426e4159e87d695cb
3
+ metadata.gz: fe22eeb59f0091363b234940fd33e7a59891d985
4
+ data.tar.gz: 9926ca96ceda0199032d3e0b5ae5e832eb1488b8
5
5
  SHA512:
6
- metadata.gz: 0e706f1a1ba18168415218189450b201c5dcb71fad948a13645b305e4e5abfe1fb90e2907e35f98fb31303dbbc1c1cf0d093bd2bb377b70212ce938df7d5da82
7
- data.tar.gz: 91103c80cb34bb4a2b8a852157860e258f5be4699f7b19f76ce15c3a045e1f5fdb1ba336f67b974479e83f8d707f2e92040364d5f239a09396dbb032850b42d5
6
+ metadata.gz: 2ee740dc1a4e7dbd549c1e1d22197916a5365bdbd3df9af45e127805f7cf84b2005f8df3cbdc9f9447381718e30931d751184030147571f52818998e434b3870
7
+ data.tar.gz: 76cf2ad9801df5220493994e3b2b34cf49096f46eb16869a668a29a4fda4a8cbce560d9c1da390b4f0b45f7b8fb5d89e3d47324b870928f7abb5d7d7496dbc4d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## [0.4.3](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.3) (2016-05-04)
4
+ [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.4.2...0.4.3)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - Less false positive
9
+
3
10
  ## [0.4.2](https://rubygems.org/gems/puppet-ghostbuster/versions/0.4.2) (2016-05-02)
4
11
  [Full Changelog](https://github.com/camptocamp/puppet-ghostbuster/compare/0.4.1...0.4.2)
5
12
 
@@ -43,16 +43,16 @@ class PuppetGhostbuster::OptParser
43
43
  PuppetGhostbuster.configuration.puppetdbserverurl = s
44
44
  end
45
45
 
46
- opts.on('--key FILE', 'Load private key from the given file.') do |file|
47
- PuppetGhostbuster.configuration.hostprivkey
46
+ opts.on('--key FILE', 'Load private key from the given file.') do |key|
47
+ PuppetGhostbuster.configuration.hostprivkey = key
48
48
  end
49
49
 
50
- opts.on('--cert FILE', 'Load cert from the given file.') do |file|
51
- PuppetGhostbuster.configuration.hostcert
50
+ opts.on('--cert FILE', 'Load cert from the given file.') do |cert|
51
+ PuppetGhostbuster.configuration.hostcert = cert
52
52
  end
53
53
 
54
- opts.on('--ca FILE', 'Load local ca cert from the given file.') do |file|
55
- PuppetGhostbuster.configuration.localcacert
54
+ opts.on('--ca FILE', 'Load local ca cert from the given file.') do |ca|
55
+ PuppetGhostbuster.configuration.localcacert = ca
56
56
  end
57
57
 
58
58
  opts.load('/etc/puppet-ghostbuster.rc')
@@ -1,3 +1,3 @@
1
1
  class PuppetGhostbuster
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3'
3
3
  end
@@ -146,21 +146,40 @@ class PuppetGhostbuster
146
146
  files.each do |file|
147
147
  next unless File.file?(file)
148
148
  module_name, file_name = file.match(/.*\/([^\/]+)\/files\/(.+)$/).captures
149
- count = 0
149
+ found = false
150
+
151
+ found = true if self.class.client.request('resources', [:'=', ['parameter', 'source'], "^puppet:///modules/#{module_name}/#{file_name}$"],).data.size > 0
152
+
153
+ dir_name = File.dirname(file_name)
154
+ while dir_name != '.' do
155
+ found = true if self.class.client.request(
156
+ 'resources',
157
+ [:'and',
158
+ [:'=', ['parameter', 'source'], "^puppet:///modules/#{module_name}/#{dir_name}/?$"],
159
+ [:'=', ['parameter', 'recurse'], true],
160
+ ],
161
+ ).data.size > 0
162
+ dir_name = File.dirname(dir_name)
163
+ end
164
+
150
165
  manifests.each do |manifest|
151
166
  if File.symlink?(manifest)
152
167
  @@logger.warn " Skipping symlink #{manifest}"
153
168
  next
154
169
  end
170
+
155
171
  if match = manifest.match(/.*\/([^\/]+)\/manifests\/.+$/)
156
172
  manifest_module_name = match.captures[0]
157
173
  if manifest_module_name == module_name
158
- count += File.readlines(manifest).grep(/["']\$\{module_name\}\/#{file_name}["']/).size
174
+ found = true if File.readlines(manifest).grep(/["']\$\{module_name\}\/#{file_name}["']/).size > 0
175
+ break if found
159
176
  end
160
177
  end
161
- count += File.readlines(manifest).grep(/#{module_name}\/#{file_name}/).size
178
+ found = true if File.readlines(manifest).grep(/#{module_name}\/#{file_name}/).size > 0
179
+ break if found
162
180
  end
163
- @@issues << { :title => "[GhostBuster] File #{module_name}/#{file_name} seems unused", :body => file } if count == 0
181
+
182
+ @@issues << { :title => "[GhostBuster] File #{module_name}/#{file_name} seems unused", :body => file } if found
164
183
  end
165
184
  end
166
185
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-ghostbuster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camptocamp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-02 00:00:00.000000000 Z
11
+ date: 2016-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls