When a record is local, require the service
This commit is contained in:
parent
dddbe28cb9
commit
6d655fbfbc
@ -1,6 +1,20 @@
|
||||
require 'socket'
|
||||
require 'resolv'
|
||||
|
||||
Puppet::Type.newtype(:resource_record) do
|
||||
@doc = 'A Resource Record in the Domain Name System'
|
||||
|
||||
autorequire(:service) do
|
||||
reqs = []
|
||||
# Depend on the bind service if the record is local
|
||||
reqs << 'bind' if Socket.ip_address_list.any? do |intf|
|
||||
Resolv.getaddresses(self[:server]).any? do |addr|
|
||||
intf.ip_address === addr
|
||||
end
|
||||
end
|
||||
reqs
|
||||
end
|
||||
|
||||
ensurable
|
||||
|
||||
newparam(:title, :namevar => true) do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user