Skip to content

Commit

Permalink
Use a relative factsdir for the lib
Browse files Browse the repository at this point in the history
  • Loading branch information
raphink committed Aug 27, 2015
1 parent c5f061c commit 2c31191
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/facterdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
module FacterDB

def self.get_os_facts(facter_version='*', filter=[])
facts_dir = File.expand_path(File.join(File.dirname(__FILE__), '../facts'))
filter_str = filter.map { |f| f.map { |k,v | "#{k}=#{v}" }.join(' and ') }.join(' or ')

jsons = Dir.glob("facts/#{facter_version}/*.facts").map { |f| File.read(f) }
jsons = Dir.glob("#{facts_dir}/#{facter_version}/*.facts").map { |f| File.read(f) }
json = "[#{jsons.join(',')}]\n"
JGrep.jgrep(json, filter_str)
end
Expand Down

0 comments on commit 2c31191

Please sign in to comment.