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

[VSphere] Removed dependency to the Datacenters root path. So that now it should even work with other localizations.

This commit is contained in:
Marc Grimme 2013-02-15 10:14:50 +01:00
parent e1cfca8f20
commit 0a420abd94

View file

@ -27,9 +27,11 @@ module Fog
# The required path syntax - 'topfolder/subfolder
# Clean up path to be relative since we're providing datacenter name
paths = path.sub(/^\/?Datacenters\/#{datacenter_name}\/vm\/?/, '').split('/')
dc = find_raw_datacenter(datacenter_name)
dc_root_folder = dc.vmFolder
# Filter the root path for this datacenter not to be used."
dc_root_folder_path=dc_root_folder.path.map { | id, name | name }.join("/")
paths = path.sub(/^\/?#{dc_root_folder_path}\/?/, '').split('/')
return dc_root_folder if paths.empty?
# Walk the tree resetting the folder pointer as we go