Fixed OpenBSD service provider with YES/NO service flags

This commit is contained in:
Ossi Salmi 2012-03-13 14:15:49 +02:00
parent 6ed4c9aafd
commit cc5af5dc4c

View file

@ -65,13 +65,14 @@ Puppet::Type.type(:service).provide :openbsd, :parent => :base do
def enabled? def enabled?
name = @resource[:name] name = @resource[:name]
rcvar = self.rcvar rcvar = self.rcvar
rcvar_name = self.rcvar_name
rcvar_value = self.rcvar_value rcvar_value = self.rcvar_value
pkg_scripts = self.pkg_scripts pkg_scripts = self.pkg_scripts
if rcvar.nil? and not pkg_scripts.include?(name) if rcvar_name.end_with?("_flags")
return :false return :false if rcvar.nil? and not pkg_scripts.include?(name)
end return :false if rcvar_value.nil? or rcvar_value == "NO"
if rcvar_value.nil? or rcvar_value == "NO" else
return :false return :false if rcvar_value != "YES"
end end
:true :true
end end
@ -96,7 +97,11 @@ Puppet::Type.type(:service).provide :openbsd, :parent => :base do
rcvar_value = start[/^#{binary}\s*(.*)/, 1] rcvar_value = start[/^#{binary}\s*(.*)/, 1]
end end
end end
s += "%s=\"%s\"\n" % [rcvar_name, rcvar_value] if rcvar_name.end_with?("_flags")
s += "%s=\"%s\"\n" % [rcvar_name, rcvar_value]
else
s += "%s=YES\n" % rcvar_name
end
pkg_scripts << name if rcvar.nil? and not pkg_scripts.include?(name) pkg_scripts << name if rcvar.nil? and not pkg_scripts.include?(name)
s += "pkg_scripts=\"%s\"\n" % pkg_scripts.join(" ") s += "pkg_scripts=\"%s\"\n" % pkg_scripts.join(" ")
File.open(@@rcconf_local, "w") { |f| f << s } File.open(@@rcconf_local, "w") { |f| f << s }