Skip to content

Commit

Permalink
fix issue where single characters settings were not being saved.
Browse files Browse the repository at this point in the history
  • Loading branch information
doboy committed Sep 9, 2014
1 parent 8aeddc8 commit 681f5c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/util/ini_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ' = ')
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/puppet/util/ini_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
; yet another comment
zot = multi word value
xyzzy['thing1']['thing2']=xyzzyvalue
l=git log
EOS
template.split("\n")
}
Expand All @@ -52,6 +53,7 @@
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
Expand Down

0 comments on commit 681f5c0

Please sign in to comment.