Project

General

Profile

Actions

Bug #16577

closed

String::to_gb fails to parse "0 Bytes"

Added by Brandon Weeks over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Statistics
Target version:
Difficulty:
trivial
Triaged:
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:~$

Files

backtrace.txt backtrace.txt 24.1 KB Brandon Weeks, 09/16/2016 06:23 AM

Related issues 1 (0 open1 closed)

Related to Foreman - Bug #2314: Smaller grains for VM memory/RAM choice neededClosedMarek Hulán03/13/2013Actions
Actions #1

Updated by Marek Hulán over 8 years ago

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

Actions #2

Updated by Brandon Weeks over 8 years ago

Attached!

Minimized test case:

"0 bytes".to_gb

Actions #3

Updated by Marek Hulán over 8 years ago

  • Status changed from New to Assigned
  • Assignee set to Marek Hulán
  • Translation missing: en.field_release 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.

Actions #4

Updated by Marek Hulán over 8 years ago

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

Updated by The Foreman Bot over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • Translation missing: en.field_release 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.

Actions #7

Updated by Marek Hulán over 8 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.

Actions #8

Updated by Marek Hulán about 8 years ago

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

Updated by Dominic Cleal about 8 years ago

  • Translation missing: en.field_release set to 160
Actions

Also available in: Atom PDF