From 1486d3969c1f4ebf63c4d1c3ddb6c07f70c048b9 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 23 Nov 2007 19:33:35 -0600 Subject: Applying patch 20070913004017-6856b-cdbbba99de0b33b64874205a27833b5114fcc6b9.patch by womble -- Allow empty config settings --- CHANGELOG | 5 +++++ lib/puppet/util/settings.rb | 2 +- spec/unit/util/settings.rb | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 35e2e44dc..8f3dcc5c6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ + Empty dbserver and dbpassword settings will now be ignored when + initializing Rails connections (patch by womble). + + Configuration settings can now be blank (patch by womble). + Added calls to endpwent/endgrent when searching for user and group IDs, which fixes #791. diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 1db396dc4..bac832812 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -896,7 +896,7 @@ Generated on #{Time.now}. result[section][:_meta] ||= {} when /^\s*#/: next # Skip comments when /^\s*$/: next # Skip blanks - when /^\s*(\w+)\s*=\s*(.+)$/: # settings + when /^\s*(\w+)\s*=\s*(.*)$/: # settings var = $1.intern # We don't want to munge modes, because they're specified in octal, so we'll diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb index 620c04009..2856c574e 100755 --- a/spec/unit/util/settings.rb +++ b/spec/unit/util/settings.rb @@ -323,6 +323,17 @@ describe Puppet::Util::Settings, " when parsing its configuration" do @settings[:myfile].should == "/other/file" @settings.metadata(:myfile).should == {:owner => "luke"} end + + it "should allow empty values" do + @settings.setdefaults :section, :myarg => ["myfile", "a"] + + text = "[main] + myarg = + " + @settings.stubs(:read_file).returns(text) + @settings.parse("/some/file") + @settings[:myarg].should == "" + end end describe Puppet::Util::Settings, " when reparsing its configuration" do -- cgit