On 10 June 2010 07:16, James Turnbull <[email protected]> wrote:
>
> Signed-off-by: James Turnbull <[email protected]>
-1
Hmm, there are a whole bunch of facts/commands that require root or
behave differently. I'd rather see this implemented as a confine.
> ---
> 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"
puts isn't helpful if using facter as a library
--
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.