Merge pull request #721 from hunner/allow_floats
(MODULES-2960) Allow float postgresql_conf values
This commit is contained in:
commit
e67abfeefa
4 changed files with 15 additions and 2 deletions
BIN
lib/puppet/provider/postgresql_conf/.parsed.rb.swp
Normal file
BIN
lib/puppet/provider/postgresql_conf/.parsed.rb.swp
Normal file
Binary file not shown.
|
@ -18,12 +18,12 @@ Puppet::Type.type(:postgresql_conf).provide(
|
||||||
:to_line => proc { |h|
|
:to_line => proc { |h|
|
||||||
|
|
||||||
# simple string and numeric values don't need to be enclosed in quotes
|
# 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
|
val = h[:value].to_s
|
||||||
else
|
else
|
||||||
val = h[:value]
|
val = h[:value]
|
||||||
end
|
end
|
||||||
dontneedquote = val.match(/^(\w+)$/)
|
dontneedquote = val.match(/^([\d\.]+|\w+)$/)
|
||||||
dontneedequal = h[:name].match(/^(include|include_if_exists)$/i)
|
dontneedequal = h[:name].match(/^(include|include_if_exists)$/i)
|
||||||
|
|
||||||
str = h[:name].downcase # normalize case
|
str = h[:name].downcase # normalize case
|
||||||
|
|
BIN
spec/unit/provider/postgresql_conf/.parsed_spec.rb.swp
Normal file
BIN
spec/unit/provider/postgresql_conf/.parsed_spec.rb.swp
Normal file
Binary file not shown.
|
@ -124,6 +124,19 @@ describe provider_class do
|
||||||
"wal_segments = 32"
|
"wal_segments = 32"
|
||||||
)
|
)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue