The new name should be a symbol to be able to access the
configuration parsed from the settings file.

Signed-off-by: Brice Figureau <brice-pup...@daysofwonder.com>
---
 lib/puppet/util/settings.rb |    4 +++-
 spec/unit/util/settings.rb  |   11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index f84d2f6..cbc5574 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -306,7 +306,9 @@ class Puppet::Util::Settings
             searchpath.each do |source|
                 next if source == :name
                 @sync.synchronize do
-                    @name = @values[source][:name]
+                    if @name = @values[source][:name]
+                        @name = @name.to_sym
+                    end
                 end
                 break if @name
             end
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index c1d74a8..7ff2efd 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -235,6 +235,17 @@ describe Puppet::Util::Settings do
             @settings[:one].should == "nameval"
         end
 
+        it "should return values set in the specific section before values set 
in the main section when name has changed" do
+            text = "[main]\none = mainval\n[myname]\none = 
nameval\n[newname]\none = newnameval\n"
+            @settings.stubs(:read_file).returns(text)
+            @settings.parse
+
+            @settings[:name] = "newname"
+
+            @settings[:one].should == "newnameval"
+        end
+
+
         it "should not return values outside of its search path" do
             text = "[other]\none = oval\n"
             file = "/some/file"
-- 
1.6.0.2


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to