String::to_gb fails to parse "0 Bytes"
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:~$
#3 Updated by Marek Hulán almost 4 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.
#6 Updated by Dominic Cleal almost 4 years ago
- Legacy Backlogs Release (now unused) deleted (
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 4 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.