Bug #158

If facts are imported incorrectly or incompletely, the Statistics links does not work.

Added by Bash Shell over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:01/19/2010
Priority:NormalDue date:
Assignee:Ohad Levy% Done:

0%

Category:Web Interface
Target version:0.1-4
Difficulty: Bugzilla link:
Found in release:
Story points-
Velocity based estimate-

Description

If facts are imported incorrectly or incompletely, the Statistics links does not work:

The Statistics page says:

No Inventory data has been found - add some hosts and facts and try again

The following is shown on the Webrick console:


Processing StatisticsController#index (for 10.1.1.111 at 2010-01-18 17:11:37) [GET]
  Parameters: {"action"=>"index", "controller"=>"statistics"}
undefined method `to_label' for nil:NilClass
Rendering template within layouts/standard
Completed in 11ms (View: 6, DB: 3) | 200 OK [http://xxxx/statistics]

Re-importing facts from the beginning does not seem to help.

History

#1 Updated by Ohad Levy over 4 years ago

  • Assignee set to Ohad Levy

this diff hopefully gets the graph displayed, figuring out why there are wrong entries is another story:

diff --git a/app/models/host.rb b/app/models/host.rb
index 726d49f..72a6cba 100644
--- a/app/models/host.rb
+++ b/app/models/host.rb
@@ -336,7 +336,13 @@ class Host < Puppet::Rails::Host
   # returns sorted hash
   def self.count_distribution assocication
     output = {}
-    count(:group => assocication).each {|k,v| output[k.to_label] = v unless v == 0 }
+    count(:group => assocication).each do |k,v|
+      begin
+        output[k.to_label] = v unless v == 0
+      rescue
+        logger.info "skipped #{k} as it has has no label" 
+      end
+    end
     output
   end

#2 Updated by Bash Shell over 4 years ago

  • Assignee deleted (Ohad Levy)

Great, the missing records are skipped and the Statistics link works!

#3 Updated by Ohad Levy over 4 years ago

  • Category set to Web Interface
  • Assignee set to Ohad Levy
  • Target version set to 0.1-4

fixed in 2c7da33

#4 Updated by Ohad Levy over 4 years ago

  • Status changed from New to Closed

Also available in: Atom PDF