Bug #16577
closedString::to_gb fails to parse "0 Bytes"
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
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.
Updated by Brandon Weeks over 8 years ago
- File backtrace.txt backtrace.txt added
Attached!
Minimized test case:
"0 bytes".to_gb
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.
Updated by Marek Hulán over 8 years ago
- Related to Bug #2314: Smaller grains for VM memory/RAM choice needed added
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
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.
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.
Updated by Marek Hulán about 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 0771cec2351c75514abaf1c7040cdd5b74e8ef1d.
Updated by Dominic Cleal about 8 years ago
- Translation missing: en.field_release set to 160