summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2011-03-22 21:59:18 -0700
committerMatt Robinson <matt@puppetlabs.com>2011-03-22 21:59:18 -0700
commit623c2a67d45a47e0cf20b589a03adab5f867f182 (patch)
tree4bb5b4b7858a8231200f04193b901703e8d57a65
parent4a9cb92655dfcd307dabf07a90660f5e26f13e94 (diff)
parentfd4f31c3748d7e59b00473355a12fc232d173eab (diff)
Merge branch 'ticket/next/6817-19_fixes' into next
* ticket/next/6817-19_fixes: (#6817) Fix for Ruby 1.9 by calling .each_line on a string maint: cleanup whitespace
-rw-r--r--lib/facter/memory.rb36
-rw-r--r--lib/facter/util/memory.rb3
2 files changed, 19 insertions, 20 deletions
diff --git a/lib/facter/memory.rb b/lib/facter/memory.rb
index 9dd2e29..0aa5e88 100644
--- a/lib/facter/memory.rb
+++ b/lib/facter/memory.rb
@@ -23,30 +23,30 @@ 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
+ 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
+ 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
+ swap = Facter::Util::Resolution.exec('sysctl vm.swapusage')
+ encrypted = false
+ if swap =~ /\(encrypted\)/ then encrypted = true; end
+ encrypted
end
end
@@ -57,9 +57,9 @@ if Facter.value(:kernel) == "AIX" and Facter.value(:id) == "root"
if dev =~ /^\/\S+\s.*\s+(\S+)MB\s+(\S+)MB/
swaptotal += $1.to_i
swapfree += $2.to_i
- end
- end
-
+ end
+ end
+
Facter.add("SwapSize") do
confine :kernel => :aix
setcode do
@@ -154,9 +154,9 @@ if Facter.value(:kernel) == "SunOS"
if dev =~ /^\/\S+\s.*\s+(\d+)\s+(\d+)$/
swaptotal += $1.to_i / 2
swapfree += $2.to_i / 2
- end
- end
-
+ end
+ end
+
Facter.add("SwapSize") do
confine :kernel => :sunos
setcode do
diff --git a/lib/facter/util/memory.rb b/lib/facter/util/memory.rb
index 029b117..d86a423 100644
--- a/lib/facter/util/memory.rb
+++ b/lib/facter/util/memory.rb
@@ -75,7 +75,7 @@ module Facter::Memory
memspecfree = 0
vmstats = Facter::Util::Resolution.exec('vm_stat')
- vmstats.each do |vmline|
+ vmstats.each_line do |vmline|
case
when vmline =~ /page\ssize\sof\s(\d+)\sbytes/
pagesize = $1.to_i
@@ -94,4 +94,3 @@ module Facter::Memory
end
end
end
-