Skip to content

Commit

Permalink
Merge pull request #62 from apuntamb/empty_allocation
Browse files Browse the repository at this point in the history
Handle blank text in allocation
  • Loading branch information
strzibny authored Aug 27, 2019
2 parents 914c8ca + 1e5a3b0 commit 55ed359
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/fog/libvirt/models/compute/volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,12 @@ def defaults
end

def split_size_unit(text)
if text.kind_of? Integer
# if text is an integer, match will fail
size = text
unit = 'G'
else
matcher = text.match(/(\d+)(.+)/)
if (text.kind_of? String) && (matcher = text.match(/(\d+)(.+)/))
size = matcher[1]
unit = matcher[2]
else
size = text.to_i
unit = "G"
end
[size, unit]
end
Expand Down

0 comments on commit 55ed359

Please sign in to comment.