Check for API support for autorequire
`Socket.ip_address_list` is a new addition to ruby 1.9. Maintain support for ruby 1.8.7 by making the new autorequire feature of `resource_record` conditional on the existence of the required API.
This commit is contained in:
parent
ba06763b96
commit
2fb9d23c01
@ -7,9 +7,11 @@ Puppet::Type.newtype(:resource_record) do
|
||||
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
|
||||
if Socket.respond_to? :ip_address_list
|
||||
reqs << 'bind' if Socket.ip_address_list.any? do |intf|
|
||||
Resolv.getaddresses(self[:server]).any? do |addr|
|
||||
intf.ip_address === addr
|
||||
end
|
||||
end
|
||||
end
|
||||
reqs
|
||||
|
||||
Loading…
Reference in New Issue
Block a user