Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MODULES-2960) Allow float postgresql_conf values #721

Merged
merged 1 commit into from
Jan 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/puppet/provider/postgresql_conf/parsed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
: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
Expand Down
Binary file not shown.
13 changes: 13 additions & 0 deletions spec/unit/provider/postgresql_conf/parsed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@
"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