Added support for disabling services via rc.conf.local on OpenBSD service provider.
This commit is contained in:
parent
54a47ae223
commit
2a969508be
1 changed files with 19 additions and 1 deletions
|
@ -99,7 +99,25 @@ Puppet::Type.type(:service).provide :openbsd, :parent => :base do
|
||||||
end
|
end
|
||||||
|
|
||||||
def disable
|
def disable
|
||||||
print "disabling #{@resource[:name]}\n"
|
flag = getrcconf()
|
||||||
|
if flag
|
||||||
|
newdata = ""
|
||||||
|
File.readlines(@@rcconflocal).each { |line|
|
||||||
|
if line.strip.split(/=/, 2)[0] == flag
|
||||||
|
next
|
||||||
|
else
|
||||||
|
newdata += line
|
||||||
|
end
|
||||||
|
}
|
||||||
|
if flag == @resource[:name] or flag == "#{@resource[:name]}_flags"
|
||||||
|
newdata += "%s=NO\n" % flag
|
||||||
|
end
|
||||||
|
f = File.open(@@rcconflocal, "w")
|
||||||
|
f.write(newdata)
|
||||||
|
f.close
|
||||||
|
else
|
||||||
|
print "disabling services from rc.local not implemented\n"
|
||||||
|
end
|
||||||
return :true
|
return :true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue