mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
delete disks
This commit is contained in:
parent
4137a76d7a
commit
905fe640ca
1 changed files with 5 additions and 1 deletions
|
@ -85,6 +85,10 @@ module Fog
|
|||
@items << new_hard_disk
|
||||
end
|
||||
|
||||
def delete_hard_disk(disk_number)
|
||||
@items.delete_if {|item| item['resource_type'] == 17 && item['element_name'] =~ /#{disk_number}$/ }
|
||||
end
|
||||
|
||||
def disks
|
||||
{ 'disks' => @items }
|
||||
end
|
||||
|
@ -156,7 +160,7 @@ module Fog
|
|||
element_names = hard_disks.map{|item| item['element_name'] }
|
||||
only_numbers = element_names.map{|b| b.scan(/\d+/).first.to_i} # extract numbers
|
||||
last_number = only_numbers.sort.last # get the last number
|
||||
hard_disks.detect{|hard_disk| hard_disk =! /#{last_number}/ }
|
||||
hard_disks.detect{|hard_disk| hard_disk =~ /#{last_number}$/ }
|
||||
end
|
||||
|
||||
def increase_hard_disk_name(hard_disk_name)
|
||||
|
|
Loading…
Reference in a new issue