Skip to content

Commit 42aa804

Browse files
Merge pull request #1544 from SimonHoenscheid/fix_regex_add_tests
postgresql_conf: Fix regex for value param and add tests
2 parents a3f6eeb + e3dabd1 commit 42aa804

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/puppet/type/postgresql_conf.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
newproperty(:value) do
1818
desc 'The value to set for this parameter.'
19-
newvalues(%r{^\S(.*\S)?$})
19+
newvalues(%r{^(\S.*)?$})
2020

2121
munge do |value|
2222
if value.to_i.to_s == value

spec/unit/type/postgresql_conf_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@
101101
end
102102
# string https://www.postgresql.org/docs/current/datatype-character.html
103103
describe 'validate complex string values with newvalues function' do
104+
it 'validates log_line_prefix with value [%p] %q:%u:%d:%' do
105+
expect { described_class.new(name: 'log_line_prefix', value: '[%p] %q:%u:%d:%x ') }.not_to raise_error
106+
end
107+
it 'validates log_line_prefix with value %t %q%u@%d %p %i' do
108+
expect { described_class.new(name: 'log_line_prefix', value: '%t %q%u@%d %p %i ') }.not_to raise_error
109+
end
104110
it 'validates log_filename with value psql_01-%Y-%m-%d.log' do
105111
expect { described_class.new(name: 'log_filename', value: 'psql_01-%Y-%m-%d.log') }.not_to raise_error
106112
end

0 commit comments

Comments
 (0)