diff options
author | Micah Anderson <micah@riseup.net> | 2013-08-10 20:56:02 +0200 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2013-08-10 20:56:02 +0200 |
commit | a70f43599a375c22f4c474ea9add49684efcda6b (patch) | |
tree | b0e2d7dc5f05b70a0a7659ad93c5f2ff9e35cc02 | |
parent | 3ee1d666927fcb440b8ef22d35246a175277c605 (diff) | |
parent | f568a45101e8ef78c9bd03f6a8f38b56f1398ded (diff) |
Merge remote-tracking branch 'immerda/master' into leap
-rw-r--r-- | lib/facter/strongswan_ips.rb | 13 | ||||
-rw-r--r-- | manifests/base.pp | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/facter/strongswan_ips.rb b/lib/facter/strongswan_ips.rb index 7fac37e..4382d07 100644 --- a/lib/facter/strongswan_ips.rb +++ b/lib/facter/strongswan_ips.rb @@ -1,10 +1,13 @@ 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]'").to_s.split("\n").collect(&:strip) - result = output.join(',') unless output.empty? + bin = ['/usr/sbin/ipsec', '/usr/sbin/strongswan'].find do |f| + File.exists?(f) + end + if bin + output = Facter::Util::Resolution.exec( + "#{bin} statusall | grep -E '^ [0-9a-f]' | sort | uniq") + output = output.to_s.split("\n").collect(&:strip) + output.join(',') unless output.empty? end - result end end diff --git a/manifests/base.pp b/manifests/base.pp index d02ed57..b5742c3 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -50,7 +50,7 @@ class strongswan::base { '/etc/ipsec.conf': content => template($strongswan::ipsec_conf_template); "/usr/local/sbin/${binary_name}_connected_hosts": - content => "#!/bin/bash\n${strongswan::binary} status | grep ESTABLISHED | awk -F\\[ '{ print \$1 }'\n", + content => "#!/bin/bash\n${strongswan::binary} status | grep INSTALLED | awk -F\\{ '{ print \$1 }'\n", notify => undef, mode => '0500'; "/usr/local/sbin/${binary_name}_start_unconnected": |