mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Fix nested folders in get virtual machine
This commit is contained in:
parent
268c6d5502
commit
458644e745
1 changed files with 4 additions and 3 deletions
|
@ -31,9 +31,10 @@ module Fog
|
|||
def get_vm_by_name(name, dc)
|
||||
vms = raw_list_all_virtual_machines(dc)
|
||||
|
||||
if name.include?('/')
|
||||
folder, basename = name.split('/')
|
||||
vms.keep_if { |v| v["name"] == basename && v.parent["name"] == folder }.first
|
||||
if name.include?('/')
|
||||
folder = File.dirname(name)
|
||||
basename = File.basename(name)
|
||||
vms.keep_if { |v| v["name"] == basename && v.parent.pretty_path.include?(folder) }.first
|
||||
else
|
||||
vms.keep_if { |v| v["name"] == name }.first
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue