Bug #158
If facts are imported incorrectly or incompletely, the Statistics links does not work.
| Status: | Closed | Start: | 01/19/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 0% |
||
| Category: | Web Interface | |||
| Target version: | 0.1-4 | |||
| Backlog: | Difficulity: | |||
| Votes: | 0 |
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
Updated by Ohad Levy over 3 years ago
- Assigned to 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
Updated by Bash Shell over 3 years ago
- Assigned to deleted (
Ohad Levy)
Great, the missing records are skipped and the Statistics link works!
Updated by Ohad Levy over 3 years ago
- Category set to Web Interface
- Assigned to set to Ohad Levy
- Target version set to 0.1-4
fixed in 2c7da33
Updated by Ohad Levy over 3 years ago
- Status changed from New to Closed
