Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/facter/facter_dot_d.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
class Facter::Util::DotD
require 'yaml'

def initialize(dir="/etc/facts.d", cache_file="/tmp/facts_cache.yml")
def initialize(dir="/etc/facts.d", cache_file=File.join(Puppet[:libdir], "facts_dot_d.cache"))
@dir = dir
@cache_file = cache_file
@cache = nil
@types = {".txt" => :txt, ".json" => :json, ".yaml" => :yaml}
end

def entries
Dir.entries(@dir).reject{|f| f =~ /^\.|\.ttl$/}.sort.map {|f| File.join(@dir, f) }
Dir.entries(@dir).reject { |f| f =~ /^\.|\.ttl$/ }.sort.map { |f| File.join(@dir, f) }
rescue
[]
end
Expand Down Expand Up @@ -113,7 +113,7 @@ def script_parser(file)

def cache_save!
cache = load_cache
File.open(@cache_file, "w", 0600) {|f| f.write(YAML.dump(cache)) }
File.open(@cache_file, "w", 0600) { |f| f.write(YAML.dump(cache)) }
rescue
end

Expand Down