The default type would always have a section as part of its namevar, but if
you're inheriting from ini_setting you may be modelling a flat file with no
sections.
This pushes the formation of the namevar from the section_name and setting into
a method, then demonstrates overriding it so that inherited_ini_setting can just
be
inherited_ini_file { 'setting':
value => '12',
}
and continue to be purgable.
If you follow the example in the README you may not have implemented the
:key_value_separator parameter in your type, and you get the wonderful failure
case:
Puppet::Error: Invalid parameter key_val_separator(:key_val_separator)
This change looks first, and if the user hasn't specified that attribute in
their type in their type, it falls back to '='
smb.conf contains settings names with white spaces, for example
[globel]
server role = active directory domain controller
check password script = Disable
It is a legitimate use case to set empty values; to override a
default when an empty value is acceptable for instance. This patch
changes the regex in three ways: it 1) removes the requirement for
a non-whitespace terminator on a setting value, 2) makes the value
match non-greedy so that the \s*$ at the end can catch the newline
and 3) changes the \s*=\s* to [ \t]*=[ \t]* because we don't want
that to capture *any* whitespace (like a newline).
Our new state variable `@quote_char` was not being initialized
property if you used `ini_subsetting` for a setting that did
not yet exist. This fixes that bug.
Prior to this commit, the `ini_subsetting` type assumed that
all of the settings strings were quoted, and always wrote
out the modified value with double-quotes around it.
This commit adds tests for the case where the original setting
is not quoted, and intelligently writes the modified setting
with the same quote character (or lack thereof) that the
original setting used.
Because of the way that puppet's autoloader and pluginsync work,
modules on the master get loaded twice, which means that
you can't use Ruby constants at all w/o getting warning messages.
This commit changes all of the constants in `ini_file` to class
variables, which will avoid the warning messages.