diff options
author | James Turnbull <james@lovedthanlost.net> | 2011-03-17 02:21:14 +1100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2011-03-17 02:21:14 +1100 |
commit | 6f0757df3a82d213b234ba794a8aec94bbe448da (patch) | |
tree | 291179c74f2981a82eb624ff7d8131fd7101a1c9 /lib | |
parent | aa46ede276947d63b107e0e5730ca33214573548 (diff) | |
parent | ffd80ac4e48285121e6557a06172d47d86270a76 (diff) | |
download | facter-6f0757df3a82d213b234ba794a8aec94bbe448da.tar.gz facter-6f0757df3a82d213b234ba794a8aec94bbe448da.tar.xz facter-6f0757df3a82d213b234ba794a8aec94bbe448da.zip |
Merge remote branch 'adrien/tickets/next/5011' into next
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/memory.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/facter/memory.rb b/lib/facter/memory.rb index 86adc7f..aa67702 100644 --- a/lib/facter/memory.rb +++ b/lib/facter/memory.rb @@ -20,6 +20,36 @@ require 'facter/util/memory' end end +Facter.add("SwapSize") do + confine :kernel => :Darwin + setcode do + swap = Facter::Util::Resolution.exec('sysctl vm.swapusage') + swaptotal = 0 + if swap =~ /total = (\S+)/ then swaptotal = $1; end + swaptotal + end +end + +Facter.add("SwapFree") do + confine :kernel => :Darwin + setcode do + swap = Facter::Util::Resolution.exec('sysctl vm.swapusage') + swapfree = 0 + if swap =~ /free = (\S+)/ then swapfree = $1; end + swapfree + end +end + +Facter.add("SwapEncrypted") do + confine :kernel => :Darwin + setcode do + swap = Facter::Util::Resolution.exec('sysctl vm.swapusage') + encrypted = false + if swap =~ /\(encrypted\)/ then encrypted = true; end + encrypted + end +end + if Facter.value(:kernel) == "AIX" and Facter.value(:id) == "root" swap = Facter::Util::Resolution.exec('swap -l') swapfree, swaptotal = 0, 0 |