(MODULES-2960) Allow float postgresql_conf values

This commit is contained in:
Hunter Haugen 2016-01-29 12:38:02 -08:00
parent 8a84929b37
commit e18342829e
4 changed files with 15 additions and 2 deletions

Binary file not shown.

View file

@ -18,12 +18,12 @@ Puppet::Type.type(:postgresql_conf).provide(
:to_line => proc { |h|
# simple string and numeric values don't need to be enclosed in quotes
if h[:value].is_a?(Fixnum)
if h[:value].is_a?(Numeric)
val = h[:value].to_s
else
val = h[:value]
end
dontneedquote = val.match(/^(\w+)$/)
dontneedquote = val.match(/^([\d\.]+|\w+)$/)
dontneedequal = h[:name].match(/^(include|include_if_exists)$/i)
str = h[:name].downcase # normalize case

Binary file not shown.

View file

@ -124,6 +124,19 @@ describe provider_class do
"wal_segments = 32"
)
end
it "should allow numbers" do
expect(provider.to_line( {:name=>"integer", :value=>42, :comment=>nil, :record_type=>:parsed })).to eq(
"integer = 42"
)
end
it "should allow floats" do
expect(provider.to_line( {:name=>"float", :value=>2.71828182845, :comment=>nil, :record_type=>:parsed })).to eq(
"float = 2.71828182845"
)
end
end
end