diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2015-01-13 17:03:44 -0800 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2015-01-13 17:03:44 -0800 |
commit | 8db1f2e2f082cd688fa061fd6840cd0cea747232 (patch) | |
tree | 71413b757c0e0ec4d21727386979354e50099fdc /lib | |
parent | 413dafbb524f65ab28366553814e1680aeaab930 (diff) | |
parent | b11311ad65c925c074e6a0b34d8182b70c570225 (diff) | |
download | puppet-stdlib-8db1f2e2f082cd688fa061fd6840cd0cea747232.tar.gz puppet-stdlib-8db1f2e2f082cd688fa061fd6840cd0cea747232.tar.bz2 |
Merge pull request #395 from cyberious/FM-2130
FM-2130 Move cache file to non temp directory
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/facter_dot_d.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/facter/facter_dot_d.rb b/lib/facter/facter_dot_d.rb index 2c096b0..b058437 100644 --- a/lib/facter/facter_dot_d.rb +++ b/lib/facter/facter_dot_d.rb @@ -15,7 +15,7 @@ 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 @@ -23,7 +23,7 @@ class Facter::Util::DotD 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 @@ -113,7 +113,7 @@ class Facter::Util::DotD 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 |