Issue #4573 has been reported by Joost van Beurden.
----------------------------------------
Bug #4573: FreeBSD service does not parse rcvar output on FreeBSD < 7
http://projects.puppetlabs.com/issues/4573
Author: Joost van Beurden
Status: Unreviewed
Priority: Normal
Assigned to:
Category: FreeBSD
Target version: 2.6.1
Affected version: 2.6.1rc2
Keywords: freebsd, service, rcvar
Branch:
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.