Skip to content

Commit

Permalink
Merge pull request thias#66 from inkblot/autorequire-local-service
Browse files Browse the repository at this point in the history
When a record is local, require the service
  • Loading branch information
inkblot committed Dec 27, 2015
2 parents dddbe28 + 6d655fb commit 7758226
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/puppet/type/resource_record.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 7758226

Please sign in to comment.