Project

General

Profile

Actions

Bug #158

closed

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

Added by Bash Shell about 14 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Interface
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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.

Actions #1

Updated by Ohad Levy about 14 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

Actions #2

Updated by Bash Shell about 14 years ago

  • Assignee deleted (Ohad Levy)

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

Actions #3

Updated by Ohad Levy about 14 years ago

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

fixed in 2c7da33

Actions #4

Updated by Ohad Levy about 14 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF