Skip to content

Commit

Permalink
(PUP-2683) Fix fact terminus to load facts without '.' on the load path.
Browse files Browse the repository at this point in the history
The fix to PUP-2478 removed '.' from the load path, which only affected
Ruby 1.8.7.  However, the fact terminus does "load <filename>" to load
module facts.  In Ruby 1.8.7, this will fail to load because '.' is no
longer on the load path.  In Ruby 1.9.3+, loading with just a filename
assumes the current directory even without '.' on the load path.

This commit fixes the issue by joining '.' with the filename which
works in all currently supported Ruby versions.
  • Loading branch information
Peter Huene authored and Moses Mendoza committed May 30, 2014
1 parent 4b5586b commit f21ff6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/indirector/facts/facter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def self.load_facts_in_dir(dir)
begin
Puppet.info "Loading facts in #{fqfile}"
Timeout::timeout(self.timeout) do
load file
load File.join('.', file)
end
rescue SystemExit,NoMemoryError
raise
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/indirector/facts/facter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@

Dir.expects(:glob).with("*.rb").returns %w{a.rb b.rb}

Puppet::Node::Facts::Facter.expects(:load).with("a.rb")
Puppet::Node::Facts::Facter.expects(:load).with("b.rb")
Puppet::Node::Facts::Facter.expects(:load).with File.join('.', 'a.rb')
Puppet::Node::Facts::Facter.expects(:load).with File.join('.', 'b.rb')

Puppet::Node::Facts::Facter.load_facts_in_dir("mydir")
end
Expand Down

0 comments on commit f21ff6c

Please sign in to comment.