diff --git a/lib/puppet/util/ini_file.rb b/lib/puppet/util/ini_file.rb index 39775a5..bc2ce54 100644 --- a/lib/puppet/util/ini_file.rb +++ b/lib/puppet/util/ini_file.rb @@ -6,7 +6,7 @@ module Util class IniFile @@SECTION_REGEX = /^\s*\[([^\]]*)\]\s*$/ - @@SETTING_REGEX = /^(\s*)([^\[#;][\w\d\.\\\/\-\s\[\]\']*[\w\d\.\\\/\-\]])([ \t]*=[ \t]*)([\S\s]*?)\s*$/ + @@SETTING_REGEX = /^(\s*)([\w\d\.\\\/\-\s\[\]\']*[\w\d\.\\\/\-\]])([ \t]*=[ \t]*)([\S\s]*?)\s*$/ @@COMMENTED_SETTING_REGEX = /^(\s*)[#;]+(\s*)([^\[]*[\w\d\.\\\/\-]+[\w\d\.\\\/\-\[\]\']+)([ \t]*=[ \t]*)([\S\s]*?)\s*$/ def initialize(path, key_val_separator = ' = ') diff --git a/spec/unit/puppet/util/ini_file_spec.rb b/spec/unit/puppet/util/ini_file_spec.rb index 8e8da9c..b68fb09 100644 --- a/spec/unit/puppet/util/ini_file_spec.rb +++ b/spec/unit/puppet/util/ini_file_spec.rb @@ -30,6 +30,7 @@ baz=bazvalue ; yet another comment zot = multi word value xyzzy['thing1']['thing2']=xyzzyvalue + l=git log EOS template.split("\n") } @@ -52,6 +53,7 @@ baz=bazvalue subject.get_value("section2", "baz").should == "bazvalue" subject.get_value("section2", "zot").should == "multi word value" subject.get_value("section2", "xyzzy['thing1']['thing2']").should == "xyzzyvalue" + subject.get_value("section2", "l").should == "git log" end end