Issue #4573 has been updated by Matt Robinson.

Status changed from Ready for Testing to Ready for Checkin

Paired with Nick and had Russell Jackson test it out on FreeBSD 6-8.
----------------------------------------
Bug #4573: FreeBSD service does not parse rcvar output on FreeBSD < 7
http://projects.puppetlabs.com/issues/4573

Author: Joost van Beurden
Status: Ready for Checkin
Priority: Normal
Assignee: Matt Robinson
Category: FreeBSD
Target version: 2.6.x
Affected version: 
Keywords: freebsd service rcvar communitypatch
Branch: http://github.com/nicklewis/puppet/tree/ticket/2.6.x/4573


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




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to