summaryrefslogtreecommitdiff
path: root/lib/puppet/type/file_line.rb
AgeCommit message (Collapse)Author
2017-06-28(MODULES-5113) Make line support SensitiveReid Vandewiele
Do this by making it a property. The idea is to get rid of the warning that appears when a Sensitive value is passed to the line attribute.
2017-03-13(#FM-6068) allow file encoding to be specified (#726)Geoff Williams
* (#FM-6068) allow file encoding to be specified Add a new parameter `encoding` to allow non UTF-8 files to specify a file encoding. This prevents receiving the error message "invalid byte sequence in UTF-8" when special characters that are not UTF-8 encoded appear in the input stream, such as the copyright symbol. * (#FM-6068) allow file encoding to be specified Added docs and tests as requested
2016-10-06(MODULES-3590) Fix match_for_absence parameterHailee Kenney
Prior to this commit, due to a bug in the exists? method in the file_line provider, match_for_absence didn't work as described (or at all really). Update the exists? logic so that match_for_absence works as described. Additionally add a unit test to prevent regressions and update the documentation for the parameter to reflect the fact that it is ignored when `ensure => present`.
2016-07-19(modules-3407) documenting after can take a regextphoney
2016-06-28(MODULES-3507) Updates file_line path validationBryan Jen
2016-03-28[MODULES-2370] file_line.rb: Fix `line` attribute validationJohnson Earls
`file_line` type: During validation, do not require `line` attribute if: * `ensure` is `absent`, * `match` is not empty, * and `match_for_absence` is `true`. Also update `spec` tests to reflect this.
2015-10-13(MODULES-2421) improve description of file_lineDavid Schmitt
This mostly needed extraction of the existing doc strings from the type.
2015-08-06allow `match` parameter to influence `ensure => absent` behavior.Johnson Earls
Split the `destroy` method of the file_type::ruby provider into two private methods: `handle_destroy_line` which is the same as the previous `destroy` method, and `handle_destroy_with_match` which will destroy any line which matches the `match` parameter, raising an error if multiple lines match and the `multiple` parameter is not `true`. This new behavior is only used if the new boolean parameter `match_for_absence` is `true` (it defaults to `false`).
2015-08-04(MODULES-2316) Change file_type boolean parameter to symbolsDominic Cleal
Puppet's boolean parameter type is only available in Puppet 3.3 and higher, so change file_type's new "replace" parameter to a regular parameter with true and false as possible values. This matches the existing "multiple" parameter.
2015-07-30(MODULES-2024) Adding replace attribute to file_lineRaymond Maika
2015-04-09Clarifying behaviour of attributes and adding an extra example.Gerrard Geldenhuis
2014-12-16Remove line match validationHunter Haugen
The `match` attribute was validated to match `line`, except that in many cases (even the example given in the docs) a user would want to match a line entirely different from the new line. See comments on the original commit https://github.com/puppetlabs/puppetlabs-stdlib/commit/a06c0d8115892a74666676b50d4282df9850a119 and ask https://ask.puppetlabs.com/question/14366/file_line-resource-match-problems/ for further examples of confusion.
2014-07-16(MODULES-1221) Add file_line autorequire documentationThomas Linkin
This commit adds additional documentation to the file_line resource explaining how it will autorequire file resources when present.
2014-05-15Revert "Merge pull request #256 from stbenjam/2571-before"Ashley Penney
This reverts commit 8499ebdb7f892f2623295058649c67a5553d4732, reversing changes made to 08b00d9229961d7b3c3cba997bfb35c8d47e4c4b.
2014-05-14(PUP-2571) add 'before' functionality to file_lineStephen Benjamin
file_line supports adding lines after a match, but there are use cases when having "before" would be useful. For example, in Debian-based OS's, the last line of /etc/rc.local is "exit 0" it's an incredible pain to deal with that scenario today. This commit adds a 'before' parameter to the file_line type, and implements it for the ruby provider.
2013-08-29Update file_line resource to support 'after'.Dan Prince
When adding new lines to a file the 'after' option can be useful when you need to insert file lines into the middle of a file. This is particularly helpful when using file_line with sectioned config files. NOTE: the after option only works when adding new lines. If you are updating an existing (matched) line it will simply modify it in place. This assumes it was in the right place to begin with.
2013-07-11(#21416) Allow file_line to match multiple linesAlex O'Rielly
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>
2012-11-26(#14670) autorequire a file_line resource's pathPeter Meier
If we manage a file we edit with file_line, it should be autorequired by file_line. Without this patch applied the relationship is not automatically setup and the user is forced to manually manage the relationship.
2012-08-14Add support for a 'match' parameter to file_lineChris Price
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.
2012-05-23fix regression in #11017 properlyPeter Meier
We need the defaultvalues for that.
2012-05-10Make file_line default to ensure => presentJeff McCune
The examples in the file_line resource documentation state the following resource should work: file_line { 'sudo_rule': path => '/etc/sudoers', line => '%sudo ALL=(ALL) ALL', } Without this patch the example does not work because ensure is not set to present. This patch fixes the problem by setting the default value of ensure to present.
2012-02-09implement #11017 - make file_line type ensurablePeter Meier
* 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.
2011-08-18Docs: Update file_line documentationJeff McCune
This commit clarifies the behavior of the file_line resource type.
2011-08-04(#8792) Rename whole_line type to file_lineJeff McCune
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.