Bug #4746

FreeBSD service should end writing to /etc/rc.conf with a newline

Added by Fredrik Eriksson over 1 year ago. Updated over 1 year ago.

Status:Closed Start date:09/09/2010
Priority:Normal Due date:
Assignee:James Turnbull % Done:

0%

Category:service
Target version:2.6.2
Affected Puppet version: Branch:
Keywords:
Votes: 0

Description

I have a few ensure_key_value rules (from http://projects.reductivelabs.com/projects/puppet/wiki/Simple_Text_Patterns) that manipulates values in /etc/rc.conf (for example to set ip-address and so on), and I noted that sometimes a key value was not added on a new line, but instead appended on the line before.

It turns out that when puppet enables a service it simply adds this to rc.conf:

"\n\# Added by Puppet\n#{rcvar}_enable=\"#{yesno}\""

This is all very well but it does not end with a newline, which causes problem when trying to echo in new lines from other rules. I’ve attached a patch that simply changes this to

"\# Added by Puppet\n#{rcvar}_enable=\"#{yesno}\"\n"

to add the newline at the end instead of the beginning.

freebsd_fix_newlines_in_rc.conf.patch (575 Bytes) Fredrik Eriksson, 09/09/2010 12:17 pm

History

Updated by James Turnbull over 1 year ago

  • Category set to service
  • Status changed from Unreviewed to Accepted
  • Assignee set to James Turnbull
  • Target version set to 2.6.2

Fredrik – thanks for this. Being a FreeBSD person could you also give me a view on #4573? Does that patch work/fix that issue?

Updated by Markus Roberts over 1 year ago

  • Status changed from Accepted to Closed

Pushed to 2.6.x as commit:bba04e08ccf631291a042cca5985591899eca869

Also available in: Atom PDF