1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[libvirt|compute] Handle integer capacities

This commit is contained in:
Greg Sutcliffe 2014-03-05 17:10:22 +00:00
parent 46b53e0db7
commit 5334fcd8cd

View file

@ -107,9 +107,15 @@ module Fog
end
def split_size_unit(text)
matcher=text.match(/(\d+)(.+)/)
size = matcher[1]
unit = matcher[2]
if text.kind_of? Integer
# if text is an integer, match will fail
size = text
unit = 'G'
else
matcher = text.match(/(\d+)(.+)/)
size = matcher[1]
unit = matcher[2]
end
[size, unit]
end
end