Skip to content

Commit 7758226

Browse files
committed
Merge pull request thias#66 from inkblot/autorequire-local-service
When a record is local, require the service
2 parents dddbe28 + 6d655fb commit 7758226

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/puppet/type/resource_record.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
require 'socket'
2+
require 'resolv'
3+
14
Puppet::Type.newtype(:resource_record) do
25
@doc = 'A Resource Record in the Domain Name System'
36

7+
autorequire(:service) do
8+
reqs = []
9+
# Depend on the bind service if the record is local
10+
reqs << 'bind' if Socket.ip_address_list.any? do |intf|
11+
Resolv.getaddresses(self[:server]).any? do |addr|
12+
intf.ip_address === addr
13+
end
14+
end
15+
reqs
16+
end
17+
418
ensurable
519

620
newparam(:title, :namevar => true) do

0 commit comments

Comments
 (0)