diff options
| author | Luke Kanies <luke@madstop.com> | 2008-05-16 15:42:20 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-05-16 15:42:20 -0500 |
| commit | 8008bbc447764e0ca28169284f4d6df3a86dcdd6 (patch) | |
| tree | f4f8a09b0b4ffcfac8f9196c9977fbcb21b6cece | |
| parent | a02c6bbe7ccac05593c9e07e9f0215ab6ceda8ad (diff) | |
| download | puppet-8008bbc447764e0ca28169284f4d6df3a86dcdd6.tar.gz puppet-8008bbc447764e0ca28169284f4d6df3a86dcdd6.tar.xz puppet-8008bbc447764e0ca28169284f4d6df3a86dcdd6.zip | |
Modified the 'factpath' setting to automatically configure
Facter to load facts there if a new enough version of
Facter is used.
| -rw-r--r-- | CHANGELOG | 4 | ||||
| -rw-r--r-- | lib/puppet/defaults.rb | 8 | ||||
| -rwxr-xr-x | spec/integration/defaults.rb | 17 |
3 files changed, 26 insertions, 3 deletions
@@ -1,3 +1,7 @@ + Modified the 'factpath' setting to automatically configure + Facter to load facts there if a new enough version of + Facter is used. + Added ldap providers for users and groups. Added support for the --all option to puppetca --clean. If diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index df2fb9425..57299b7e7 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -505,9 +505,11 @@ module Puppet # Central fact information. self.setdefaults(:main, - :factpath => ["$vardir/facts", - "Where Puppet should look for facts. Multiple directories should - be colon-separated, like normal PATH variables."], + :factpath => {:default => "$vardir/facts", + :desc => "Where Puppet should look for facts. Multiple directories should + be colon-separated, like normal PATH variables.", + :call_on_define => true, # Call our hook with the default value, so we always get the value added to facter. + :hook => proc { |value| Facter.search(value) if Facter.respond_to?(:search) }}, :factdest => ["$vardir/facts", "Where Puppet should store facts that it pulls down from the central server."], diff --git a/spec/integration/defaults.rb b/spec/integration/defaults.rb new file mode 100755 index 000000000..b14a141fb --- /dev/null +++ b/spec/integration/defaults.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../spec_helper' + +require 'puppet/defaults' + +describe "Puppet defaults" do + describe "when setting the :factpath" do + after { Puppet.settings.clear } + + it "should add the :factpath to Facter's search paths" do + Facter.expects(:search).with("/my/fact/path") + + Puppet.settings[:factpath] = "/my/fact/path" + end + end +end |
