From fd322638bff182f6cdb4918137bfe15c84836f37 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 7 Jul 2011 13:12:27 +0200 Subject: [PATCH] feature #696: Fix string or symbol error --- src/acct/watch_client.rb | 16 ++++++++-------- src/acct/watch_helper.rb | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/acct/watch_client.rb b/src/acct/watch_client.rb index 4fbd9552de..bcceb40d66 100644 --- a/src/acct/watch_client.rb +++ b/src/acct/watch_client.rb @@ -54,11 +54,11 @@ module OneWatchClient mon = Hash.new monitoring_resources.each { |opt| - mon[opt] = case opt - when allowed_samples.include?(opt) - sum_monitoring(rsql, kind, opt) - when "total", "active", "error" - count_monitoring(rsql, opt) + opt = opt.to_sym + if allowed_samples.has_key?(opt) + mon[opt] = sum_monitoring(rsql, kind, opt) + elsif [:total, :active, :error].include?(opt) + mon[opt] = count_monitoring(rsql, opt) end } @@ -85,9 +85,9 @@ module OneWatchClient def count_monitoring(rsql, opt) resources = case opt - when "total" then rsql - when "active" then rsql.active - when "error" then rsql.error + when :total then rsql + when :active then rsql.active + when :error then rsql.error else return nil end diff --git a/src/acct/watch_helper.rb b/src/acct/watch_helper.rb index 7204d73231..c527b5b9ba 100644 --- a/src/acct/watch_helper.rb +++ b/src/acct/watch_helper.rb @@ -103,7 +103,7 @@ module WatchHelper :timestamp => timestamp, :last_poll => vm['LAST_POLL'], :state => vm['STATE'], - :lcm_state => vm['LCM_STATE'], + :lcm_state => vm['LCM_STATE'] } VM_SAMPLE.each { |key,value|