Signed-off-by: James Turnbull <[email protected]>
---
 lib/facter/memory.rb |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/facter/memory.rb b/lib/facter/memory.rb
index f0f0d45..94769d0 100644
--- a/lib/facter/memory.rb
+++ b/lib/facter/memory.rb
@@ -21,15 +21,19 @@ require 'facter/util/memory'
 end
 
 if Facter.value(:kernel) == "AIX"
-    swap = Facter::Util::Resolution.exec('swap -l')
-    swapfree, swaptotal = 0, 0
-    swap.each do |dev|
+    begin
+      swap = Facter::Util::Resolution.exec('swap -l')
+      swapfree, swaptotal = 0, 0
+      swap.each do |dev|
         if dev =~ /^\/\S+\s.*\s+(\S+)MB\s+(\S+)MB/
             swaptotal += $1.to_i
             swapfree  += $2.to_i
-        end
+        end 
+      end 
+    rescue Exception => e
+      puts "You must be root to run swap -l on AIX"    
     end
-
+ 
     Facter.add("SwapSize") do
         confine :kernel => :aix
         setcode do
-- 
1.6.6.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to