kassia needs to listen on submission
[mirror/dsa-puppet.git] / facts / services.rb
1 ["bugs","qa"].each do |service|
2         Facter.add(service + "_host") do
3                 service_name = "#{service}." + Facter.domain
4                 active = false
5
6                 setcode do
7                         if FileTest.exist?("/usr/bin/dig")
8                                 %x{/usr/bin/dig +short -t a #{service_name}}.chomp.each do |service_ip|
9                                         Facter.interfaces.split(',').each do |my_interface|
10                                                 my_ip = Facter.value("ipaddress_" + my_interface)
11                                                 if my_ip == service_ip
12                                                         active = "true"
13                                                 end
14                                         end
15                                 end
16                         end
17                         active
18                 end
19         end
20 end