]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/inifile/lib/puppet/type/ini_subsetting.rb
add puppetlabs/inifile to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / inifile / lib / puppet / type / ini_subsetting.rb
1 Puppet::Type.newtype(:ini_subsetting) do
2
3   ensurable do
4     defaultvalues
5     defaultto :present
6   end
7
8   newparam(:name, :namevar => true) do
9     desc 'An arbitrary name used as the identity of the resource.'
10   end
11
12   newparam(:section) do
13     desc 'The name of the section in the ini file in which the setting should be defined.' +
14       'If not provided, defaults to global, top of file, sections.'
15     defaultto("")
16   end
17
18   newparam(:setting) do
19     desc 'The name of the setting to be defined.'
20   end
21
22   newparam(:subsetting) do
23     desc 'The name of the subsetting to be defined.'
24   end
25
26   newparam(:subsetting_separator) do
27     desc 'The separator string between subsettings. Defaults to " "'
28     defaultto(" ")
29   end
30
31   newparam(:path) do
32     desc 'The ini file Puppet will ensure contains the specified setting.'
33     validate do |value|
34       unless (Puppet.features.posix? and value =~ /^\//) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/))
35         raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'")
36       end
37     end
38   end
39
40   newparam(:key_val_separator) do
41     desc 'The separator string to use between each setting name and value. ' +
42         'Defaults to " = ", but you could use this to override e.g. ": ", or' +
43         'whether or not the separator should include whitespace.'
44     defaultto(" = ")
45   end
46
47   newparam(:quote_char) do
48     desc 'The character used to quote the entire value of the setting. ' +
49         %q{Valid values are '', '"' and "'". Defaults to ''.}
50     defaultto('')
51
52     validate do |value|
53       unless value =~ /^["']?$/
54         raise Puppet::Error, %q{:quote_char valid values are '', '"' and "'"}
55       end
56     end
57   end
58
59   newproperty(:value) do
60     desc 'The value of the subsetting to be defined.'
61   end
62
63 end