summaryrefslogtreecommitdiff
path: root/lib/facter/strongswan_ips.rb
blob: 7d6f30b7997e1585e7223836e7879f50466a77a6 (plain)
1
2
3
4
5
6
7
8
9
10
Facter.add("strongswan_ips") do
  setcode do
    result = nil
    if bin = ['/usr/sbin/ipsec', '/usr/sbin/strongswan'].find{|f| File.exists?(f) } 
      output = Facter::Util::Resolution.exec("#{bin} statusall | grep -E '^  [0-9a-f]'").split("\n").collect(&:strip)
      result = output.join(',') unless output.empty?
    end
    result
  end
end