puppetlabs/puppetlabs-stdlib — pull request #62 by mmckinst (2012-04-12 19:54:11+00:00)
Title: bug #13917 - file_line messes up if a file doesn't end with a newline

http://projects.puppetlabs.com/issues/13917

If a file doesn’t end with a new line, file_line will append its line to the last line of the file instead of starting a new line for itself.

$ cat foo.pp
file_line { 'messes up when there is no newline':
line => 'bar=2',
path => '/tmp/test.txt',
}
$ # create that doesn't end with a newline
$ echo -n 'foo=1' > /tmp/test.txt
$ puppet apply foo.pp
notice: /Stage[main]//File_line[messes up when there is no newline]/ensure: created
notice: Finished catalog run in 0.21 seconds
$ cat /tmp/test.txt
foo=1bar=2
$