This is another bit of cosmetic functionality; prior to
this commit, when adding a new setting to a section, we'd
write it on the very last line before the next section,
even if there was a chunk of trailing whitespace lines
at the end of the existing section. This was functional,
but the output was not always particularly pleasant for
human consumption.
This commit tweaks things so that we insert new settings
just before the final chunk of whitespace lines in an
existing section. This keeps things a bit cleaner.
This commit adds some cosmetic functionality. The main two
improvements are:
* We'll now pay attention to indentation within existing
sections, and when we write new settings or update
existing ones, we'll match the existing indentation.
* When modifying existing settings, the regex now captures
a greater portion of the original line and preserves it.
Basically, the original whitespacing in the line should
remain intact and only the value should be modified.
This commit makes some minor changes to how we handle removing
settings. In particular, it updates all of the line numbers
of the various 'section' objects to correspond to the new
state of the world based on the removal of a line that appeared
before them.
Also adds one more test related to setting removal.
This commit converts value to a property so that it
can be managed and modified when a file already has
a value set.
It was previously treating the line creation state
the same as the update case, which is not in
alignment with Puppet's model.
Previously, the following stanza would fail as a result of the
ini_setting type not being able to parse spaces in setting values.
ini_setting { 'main_config_version':
ensure => present,
path => '/etc/puppetlabs/puppet/puppet.conf',
section => 'main',
setting => 'config_version',
value => '/etc/puppetlabs/puppet/config_version.sh $environment',
}
This commit modifes the SETTING_REGEX to account for spaces in setting values.
This introduces a new parameter, 'key_val_separator', which
can be set in order to override the string that is used
as a separator between the key/value pair of a setting line.
The default is ' = ', but you could set the param to '=' if
you don't want to include whitespace in your settings file.
This commit does the following:
* Fixes a bug in ExternalIterator
* Adds support for a "global" section before the first named
section at the beginning of the INI file
* Improves test coverage
characters. Fixed writing to file without any sections at all.
Fixed exists checking for variable type by always casting to string
and added all the tests for the above items.