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)
Actions