Bug #4573

FreeBSD service does not parse rcvar output on FreeBSD < 7

Added by Joost van Beurden almost 2 years ago. Updated about 1 month ago.

Status:Closed Start date:08/19/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:FreeBSD
Target version:2.6.3
Affected Puppet version: Branch:http://github.com/nicklewis/puppet/tree/ticket/2.6.x/4573
Keywords:freebsd service rcvar communitypatch
Votes: 0

Description

The output of /usr/local/etc/rc.d/[service] rcvar on FreeBSD < 7 is (mind the $ sign):

# ntpd
$ntpd_enable=NO

This is not properly parsed by the FeeBSD service module. I’ve installed Puppet from ports (version 2.6.1rc2) and the ports also installed the patch from issue 4383. The FreeBSD service module (with or without the patch) does not parse the output of rcvar correctly.

Since FreeBSD 7 (I suppose, I’m not sure when the $ sign has been removed from the rcvar output) until FreeBSD 8.0, the output of rcvar looks like:

# ntpd
ntpd_enable=YES

Since FreeBSD 8.1 the output of rcvar looks like:

# ntpd
#
ntpd_enable="YES"
#   (default: "")

The patch from issue 4383 was to correctly parse the new rcvar output.

I suggest the following fix. I would be amazed if this cannot be improved by someone who knows Ruby better than I do. I’m have been programming in Ruby for about 1 hour. :–) After a lot of trial and error this was what I came up with:

--- freebsd.rb.orig Wed Aug 18 20:14:42 2010
+++ freebsd.rb  Wed Aug 18 23:48:08 2010
@@ -18,7 +18,9 @@
def rcvar
rcvar = execute([self.initscript, :rcvar], :failonfail => true, :squelch => false)
rcvar = rcvar.split("\n")
-    rcvar.delete_if {|str| str !~ /^(#\s\S+|\w+enable=.*)$/ }
+    rcvar.delete_if {|str| str !~ /^(#\s\S+|\$?\w+enable=.*)$/ }
+    rcvar[1] = rcvar[1].gsub!(/^\$?(.*)/, '\1')
+    rcvar
end
# Extract service name

History

Updated by James Turnbull almost 2 years ago

  • Status changed from Unreviewed to Accepted

Updated by James Turnbull over 1 year ago

  • Status changed from Accepted to In Topic Branch Pending Review

Updated by James Turnbull over 1 year ago

  • Branch set to http://github.com/jamtur01/puppet/commits/tickets/2.6.x/4573

Updated by James Turnbull over 1 year ago

Joost/Alexander – can one or both of you test the patch I’ve pushed to the branch published and the puppet-dev mailing list.

Updated by James Turnbull over 1 year ago

  • Assignee set to James Turnbull

Updated by James Turnbull over 1 year ago

  • Target version changed from 2.6.1 to 2.6.2

Updated by Fredrik Eriksson over 1 year ago

As far as I can tell this patch does not break anything for FreeBSD 8.1. Unfortunately I don’t have access to any pre 8.0 servers, but so far I havn’t found any problems in 8.1.

Updated by Russell Jackson over 1 year ago

I’m the port maintainer. I hadn’t updated puppet on any of my non >= 8.0 boxes until today.

I’ll test the patch.

Updated by Russell Jackson over 1 year ago

The patch was malformed, but I fixed it. It’s not clear from the ticket, but the patch depends on the patch in 4383 to have been applied first.

Confirmed to work on 6.4, 7.3 and 8.1 hosts. I’ve added it to my local version of the port. I’ll submit a PR next week to include it in the port.

Updated by Jesse Wolfe over 1 year ago

  • Status changed from In Topic Branch Pending Review to Code Insufficient
  • Assignee deleted (James Turnbull)
  • Affected Puppet version deleted (2.6.1rc2)

Russell, would you mind sending your version of the patch to puppet-dev@googlegroups.com ?

Updated by Paul Berry over 1 year ago

  • Target version changed from 2.6.2 to 52

Setting target version to “queued”, since we would prefer to limit 2.6.x releases to fixing bugs that were introduced in 2.6.

Updated by Russell Jackson over 1 year ago

This bug make puppets unusable on FreeBSD versions less than 8. The current patch is used as a local patch on official FreeBSD package/port; there haven’t been any reported regressions due to the patch.

Is there any possibility of getting this in to 2.6.x?

I’ll send the patch to the list as requested.

Updated by Matt Robinson over 1 year ago

  • Assignee set to Matt Robinson

Updated by Matt Robinson over 1 year ago

  • Keywords changed from freebsd, service, rcvar to freebsd service rcvar communitypatch

Updated by Nick Lewis over 1 year ago

  • Status changed from Code Insufficient to In Topic Branch Pending Review
  • Branch changed from http://github.com/jamtur01/puppet/commits/tickets/2.6.x/4573 to http://github.com/nicklewis/puppet/tree/ticket/2.6.x/4573

Cleaned up the code and added specs.

Updated by James Turnbull over 1 year ago

  • Target version changed from 52 to 2.6.2

Updated by Markus Roberts over 1 year ago

  • Target version changed from 2.6.2 to 69

Process says this should be queued/2.6.x, not 2.6.2 which is presently in the rc process.

Updated by Matt Robinson over 1 year ago

  • Status changed from In Topic Branch Pending Review to Ready For Checkin

Paired with Nick and had Russell Jackson test it out on FreeBSD 6-8.

Updated by James Turnbull over 1 year ago

  • Target version changed from 69 to 2.6.3

Updated by James Turnbull over 1 year ago

  • Status changed from Ready For Checkin to Closed

Pushed in commit:4cbceab68f3d84b322d9b78ddb95c34615906bb9 in branch 2.6.x

Updated by Daniel Pittman about 1 month ago

  • Assignee deleted (Matt Robinson)

Also available in: Atom PDF