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
|
autorequire(:service) do
|
||||||
reqs = []
|
reqs = []
|
||||||
# Depend on the bind service if the record is local
|
# Depend on the bind service if the record is local
|
||||||
reqs << 'bind' if Socket.ip_address_list.any? do |intf|
|
if Socket.respond_to? :ip_address_list
|
||||||
Resolv.getaddresses(self[:server]).any? do |addr|
|
reqs << 'bind' if Socket.ip_address_list.any? do |intf|
|
||||||
intf.ip_address === addr
|
Resolv.getaddresses(self[:server]).any? do |addr|
|
||||||
|
intf.ip_address === addr
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
reqs
|
reqs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user