Skip to content

Commit

Permalink
clean up for issue #114
Browse files Browse the repository at this point in the history
  • Loading branch information
vkhatri committed Sep 4, 2017
1 parent 7bda93a commit eb909d3
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions libraries/helper.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
require 'fileutils'
# require 'regexp'

def purge_prospectors_dir
# prefixes = [/^node-prospector-.*yml$/, /^lwrp-prospector-.*yml$/, /^manual-prospector-.*yml$/]
# regexp_prefixes = Regexp.union(prefixes)
valid_prospectors = []

# collect lwrp filebeat_prospector prospectors
run_context.resource_collection.select { |resource| valid_prospectors.push("lwrp-prospector-#{resource.name}.yml") if resource.is_a?(Chef::Resource::FilebeatProspector) }

# collect node attribute node['filebeat']['prospectors'] prospectors
node['filebeat']['prospectors'].sort.map { |k, _v| valid_prospectors.push("node-prospector-#{k}.yml") }

# prospectors yml files to clean up
extra_prospectors = Dir.entries(node['filebeat']['prospectors_dir']).reject { |a| valid_prospectors.include?(a) || a.match(/^custom-prospector-.*yml$/) }.sort
extra_prospectors -= ['.', '..']
Expand Down

0 comments on commit eb909d3

Please sign in to comment.