Age | Commit message (Collapse) | Author |
|
Without this commit the file_line type will outright fail if multiple
lines match the given regex. This commit allows the file_line type and
provider to optionally match and modify all matching lines.
Changeset rebased into a single commit by Adrien Thebo <adrien@puppetlabs.com>
|
|
This commit adds a new parameter called "match"
to the file_line resource type, and support for
this new parameter to the corresponding ruby
provider.
This parameter is optional; file_line should work
just as before if you do not specify this parameter...
so this change should be backwards-compatible.
If you do specify the parameter, it is treated
as a regular expression that should be used when
looking through the file for a line. This allows
you to do things like find a line that begins with
a certain prefix (e.g., "foo=.*"), and *replace*
the existing line with the line you specify in your
"line" parameter. Without this capability, if you
already had a line "foo=bar" in your file and your
"line" parameter was set to "foo=baz", you'd end up
with *both* lines in the final file. In many cases
this is undesirable.
|
|
* Implement a simple destroy method.
* Add tests for it
* Refactor code, so file is actually read only once. However, due
to the nature how provider tests are run, we need to ensure that
the file is read before we open it to write it.
|
|
Without this patch the resource whole_line would be included in the
stable stdlib module shipping in PE 1.2. Ideally the name will be
stable and unchanging in the future.
There was quite a bit of concern over whole_line being an unwise name.
file_line appears to be the most suitable name and least likely to need
another rename in the future.
|
|
Changed the type name from append_line to
whole_line.
After feedback that having a type with a verb in
the name was confusing.
|
|
This commit adds a native type that can check if
a line exists and append it to a file.
This use case seems common enough to warrant its
inclusion into stdlib.
Reviewed-by: Jeff McCune
|