Skip to content

Commit 263eaab

Browse files
committed
Allow empty string value for config entries
PostgreSQL supports and allows config entries, such as those in postgresql.conf, to be set to the empty string. The `postgresql::server::config_entry` defined type, however, requires String[1] when supplying string values. This doesn't allow for the empty string. This change relaxes the allowed data types for the `value` parameter of `postgresql::server::config_entry` to `String` from `String[1]` and adds a spec test to support the change. Fixes #1602
1 parent 880a6f7 commit 263eaab

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

manifests/server/config_entry.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
define postgresql::server::config_entry (
1111
Enum['present', 'absent'] $ensure = 'present',
1212
String[1] $key = $name,
13-
Optional[Variant[String[1], Numeric, Array[String[1]]]] $value = undef,
13+
Optional[Variant[String, Numeric, Array[String[1]]]] $value = undef,
1414
Stdlib::Absolutepath $path = $postgresql::server::postgresql_conf_path,
1515
Optional[String[1]] $comment = undef,
1616
String[1] $instance_name = 'main',

spec/defines/server/config_entry_spec.rb

+9
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,13 @@
7979
.that_notifies('Postgresql::Server::Instance::Service[main]')
8080
end
8181
end
82+
83+
context 'set a config entry value to the empty string' do
84+
let(:params) { { ensure: 'present', name: 'mydatabase.app_specific_parameter', value: '' } }
85+
86+
it 'sets value to the empty string' do
87+
expect(subject).to contain_postgresql_conf('mydatabase.app_specific_parameter').with(name: 'mydatabase.app_specific_parameter',
88+
value: '')
89+
end
90+
end
8291
end

0 commit comments

Comments
 (0)