Skip to content

Commit b11311a

Browse files
author
Travis Fields
committed
FM-2130 Move cache file to non temp directory
1 parent 413dafb commit b11311a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/facter/facter_dot_d.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
class Facter::Util::DotD
1616
require 'yaml'
1717

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

2525
def entries
26-
Dir.entries(@dir).reject{|f| f =~ /^\.|\.ttl$/}.sort.map {|f| File.join(@dir, f) }
26+
Dir.entries(@dir).reject { |f| f =~ /^\.|\.ttl$/ }.sort.map { |f| File.join(@dir, f) }
2727
rescue
2828
[]
2929
end
@@ -113,7 +113,7 @@ def script_parser(file)
113113

114114
def cache_save!
115115
cache = load_cache
116-
File.open(@cache_file, "w", 0600) {|f| f.write(YAML.dump(cache)) }
116+
File.open(@cache_file, "w", 0600) { |f| f.write(YAML.dump(cache)) }
117117
rescue
118118
end
119119

0 commit comments

Comments
 (0)