diff options
author | Luke Kanies <luke@madstop.com> | 2008-05-05 21:14:46 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-05-05 21:14:46 -0500 |
commit | e57436f1056cceb8ecdfadfa618911c5595c72e2 (patch) | |
tree | 8e4314dbc7a754ba19c07971686ee03c8c5ed68e | |
parent | 137e29ff0e33ff5cbb4032d452abc5a5aef2c941 (diff) | |
download | puppet-e57436f1056cceb8ecdfadfa618911c5595c72e2.tar.gz puppet-e57436f1056cceb8ecdfadfa618911c5595c72e2.tar.xz puppet-e57436f1056cceb8ecdfadfa618911c5595c72e2.zip |
The Settings class now clears the 'used' sections when a value is changed.
This makes is so that if you, for instance, reset the vardir,
then the next time an initialization call is made, we reuse
any previously used sections, thus (hopefully) correctly
creating any newly needed directories.
This is mostly helpful during testing.
-rw-r--r-- | lib/puppet/util/settings.rb | 4 | ||||
-rwxr-xr-x | spec/unit/util/settings.rb | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 65668f919..09bba5b59 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -39,6 +39,8 @@ class Puppet::Util::Settings end @values[:memory][param] = value @cache.clear + + clearused end return value @@ -574,7 +576,7 @@ Generated on #{Time.now}. catalog = bucket.to_catalog rescue => detail puts detail.backtrace if Puppet[:trace] - Puppet.err "Could not create resources for managing Puppet's files and directories: %s" % detail + Puppet.err "Could not create resources for managing Puppet's files and directories in sections %s: %s" % [sections.inspect, detail] # We need some way to get rid of any resources created during the catalog creation # but not cleaned up. diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb index 441a3f4ef..ca533ef9a 100755 --- a/spec/unit/util/settings.rb +++ b/spec/unit/util/settings.rb @@ -93,6 +93,11 @@ describe Puppet::Util::Settings, " when setting values" do @settings[:myval].should == "yay" end + it "should clear the list of used sections" do + @settings.expects(:clearused) + @settings[:myval] = "yay" + end + it "should call passed blocks when values are set" do values = [] @settings.setdefaults(:section, :hooker => {:default => "yay", :desc => "boo", :hook => lambda { |v| values << v }}) |