Project

General

Profile

Bug #16577

String::to_gb fails to parse "0 Bytes"

Added by Brandon Weeks almost 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Statistics
Target version:
Difficulty:
trivial
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

On some Ubuntu 14.04 boxes with swap disabled facter returns a value of "0 bytes" for the swapfree fact. This is unparseable by String::to_gb which causes /statistics to show an error.

weeks@host:~$ facter swapfree
0 bytes
weeks@host:~$
backtrace.txt backtrace.txt 24.1 KB Brandon Weeks, 09/16/2016 06:23 AM

Related issues

Related to Foreman - Bug #2314: Smaller grains for VM memory/RAM choice neededClosed2013-03-13

Associated revisions

Revision 0771cec2 (diff)
Added by Marek Hulán almost 3 years ago

Fixes #16577 - enhance unit detection

Revision a0c79911 (diff)
Added by Marek Hulán almost 3 years ago

Fixes #16577 - enhance unit detection

(cherry picked from commit 0771cec2351c75514abaf1c7040cdd5b74e8ef1d)

History

#1 Updated by Marek Hulán almost 3 years ago

Do you by any chance have a back trace or error message? That would help to debug.

#2 Updated by Brandon Weeks almost 3 years ago

Attached!

Minimized test case:

"0 bytes".to_gb

#3 Updated by Marek Hulán almost 3 years ago

  • Status changed from New to Assigned
  • Assignee set to Marek Hulán
  • Legacy Backlogs Release (now unused) set to 160

Thanks for the trace, that helped me. It's partly caused by #2314 and partly because we don't recognize Bytes as a unit. Also we have generic rescue which hides the real cause. The fix should be easy.

#4 Updated by Marek Hulán almost 3 years ago

  • Related to Bug #2314: Smaller grains for VM memory/RAM choice needed added

#5 Updated by The Foreman Bot almost 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3854 added

#6 Updated by Dominic Cleal almost 3 years ago

  • Legacy Backlogs Release (now unused) deleted (160)

I don't think this was introduced in 1.13.0/#2314. https://github.com/theforeman/foreman/commit/eabbbeb4730abb51de2de8f9b302d26b14d6d33a#diff-54b2b2f744ded63c7d44629102bde356 only seems to change how the units are scaled.

#7 Updated by Marek Hulán almost 3 years ago

There are two parts of this bug. First is thta "Bytes" are not recognized as unit. Second is that the Foreman::SIZE was removed but remained on line which is triggered in this case. If we only fix matching, it will still fail for "0 Bytes" string because of this. If you prefer I can split this into 2 PRs, second would be only replacing the Foreman::SIZE so it would be safe to get it into 1.13.

#8 Updated by Marek Hulán almost 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#9 Updated by Dominic Cleal almost 3 years ago

  • Legacy Backlogs Release (now unused) set to 160

Also available in: Atom PDF