Skip to content

Commit b3cbf1e

Browse files
expand postgresql_conf type and provider
1 parent e2e82d3 commit b3cbf1e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

lib/puppet/provider/postgresql_conf/parsed.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
text_line :blank, match: %r{^\s*$}
1515

1616
record_line :parsed,
17-
fields: ['name', 'value', 'comment'],
17+
fields: ['key', 'value', 'comment'],
1818
optional: ['comment'],
1919
match: %r{^\s*([\w.]+)\s*=?\s*(.*?)(?:\s*#\s*(.*))?\s*$},
2020
to_line: proc { |h|
@@ -28,9 +28,9 @@
2828
h[:value]
2929
end
3030
dontneedquote = val.match(%r{^(\d+.?\d+|\w+)$})
31-
dontneedequal = h[:name].match(%r{^(include|include_if_exists)$}i)
31+
dontneedequal = h[:key].match(%r{^(include|include_if_exists)$}i)
3232

33-
str = h[:name].downcase # normalize case
33+
str = h[:key].downcase # normalize case
3434
str += dontneedequal ? ' ' : ' = '
3535
str += "'" unless dontneedquote && !dontneedequal
3636
str += val
@@ -39,7 +39,7 @@
3939
str
4040
},
4141
post_parse: proc { |h|
42-
h[:name].downcase! # normalize case
42+
h[:key].downcase! # normalize case
4343
h[:value].gsub!(%r{(^'|'$)}, '') # strip out quotes
4444
}
4545
end

lib/puppet/type/postgresql_conf.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
ensurable
77

88
newparam(:name) do
9-
desc 'The postgresql parameter name to manage.'
10-
isnamevar
9+
desc 'A unique title for the resource.'
1110

1211
newvalues(%r{^[\w.]+$})
1312
end
1413

14+
newproperty(:key) do
15+
desc 'The Postgresql parameter to manage.'
16+
newvalues(%r{^[\w.]+$})
17+
end
18+
1519
newproperty(:value) do
1620
desc 'The value to set for this parameter.'
1721
end

manifests/server/config_entry.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
postgresql_conf { $name:
8686
ensure => $ensure,
8787
target => $path,
88-
name => $key,
88+
key => $key,
8989
value => $value,
9090
require => Class['postgresql::server::initdb'],
9191
}

0 commit comments

Comments
 (0)