Actions
Bug #1656
closedstatistics page error 'Unknown string: "1.97 TB"!'
Description
After on-lining some new systems that have 2 TB of memory our statistics page started receiving errors.
Oops, we're sorry but something went wrong x Unknown string: "1.97 TB"! If you feel this is an error with Foreman itself, please open a new issue with Foreman ticketing system, You would probably need to attach the Full trace and relevant log entries. RuntimeError Unknown string: "1.97 TB"! /srv/www/usps-puppet-foreman/lib/core_extensions.rb:85:in `to_gb' /srv/www/usps-puppet-foreman/app/models/fact_value.rb:69:in `to_gb' /srv/www/usps-puppet-foreman/app/models/fact_value.rb:68:in `map' /srv/www/usps-puppet-foreman/app/models/fact_value.rb:68:in `to_gb' /srv/www/usps-puppet-foreman/app/models/fact_value.rb:29:in `mem_average' /srv/www/usps-puppet-foreman/app/controllers/statistics_controller.rb:11:in `index'
This is with version 0.4
We were able to workaround this issue by editting lib/core_extensions.rb:
--- /var/tmp/core_extensions.rb 2012-05-29 08:03:41.000000000 -0500 +++ lib/core_extensions.rb 2012-05-29 08:05:04.000000000 -0500 @@ -73,9 +73,10 @@ end class String def to_gb begin - value,f,unit=self.match(/(\d+(\.\d+)?) ?(([KMG]B?|B))$/i)[1..3] + value,f,unit=self.match(/(\d+(\.\d+)?) ?(([KMGT]B?|B))$/i)[1..3] case unit.to_sym when nil, :B, :byte then (value.to_f / 1000_000_000) + when :TB, :T, :terabyte then (value.to_f * 1000) when :GB, :G, :gigabyte then value.to_f when :MB, :M, :megabyte then (value.to_f / 1000) when :KB, :K, :kilobyte, :kB then (value.to_f / 1000_000)
Updated by Ohad Levy over 12 years ago
awesome, any chance you want to send this as a git patch instead? (so you'll get the credit:))
Updated by Jacob McCann over 12 years ago
- Assignee set to Jacob McCann
Oooh, incentives ... I'll give it a shot!
Updated by Ohad Levy over 12 years ago
- Target version set to 1.0
Jacob McCann wrote:
Oooh, incentives ... I'll give it a shot!
ping?
Updated by Jacob McCann over 12 years ago
Got it figured out I think! https://github.com/theforeman/foreman/pull/69
Thanks!
Updated by Ohad Levy over 12 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Applied in changeset c5ad288d3e715555779e2521f948d6a870e5e370.
Actions