Debian Codegraph @

lib/puppet/type/postgresql_conf.rb

raw
1 # frozen_string_literal: true
2
3 Puppet::Type.newtype(:postgresql_conf) do
4 @doc = 'This type allows puppet to manage postgresql.conf parameters.'
5 ensurable
6
7 newparam(:name) do
8 desc 'A unique title for the resource.'
9 newvalues(%r{^[\w.]+$})
10 end
11
12 newparam(:key) do
13 desc 'The Postgresql parameter to manage.'
14 newvalues(%r{^[\w.]+$})
15 end
16
17 newproperty(:value) do
18 desc 'The value to set for this parameter.'
19 newvalues(%r{^(\S.*)?$})
20
21 munge do |value|
22 if value.to_i.to_s == value
23 value.to_i
24 elsif value.to_f.to_s == value
25 value.to_f
26 else
27 value
28 end
29 end
30 end
31
32 newproperty(:comment) do
33 desc 'The comment to set for this parameter.'
34 newvalues(%r{^[\w\W]+$})
35 end
36
37 newparam(:target) do
38 desc 'The path to the postgresql config file'
39 newvalues(%r{^/\S+[a-z0-9(/)-]*\w+.conf$})
40 end
41 end