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

Adding a path attribute to the vm_mob_ref hash

This patch adds a new `path` attribute to the vm_mob_ref hash returned
by the `convert_vm_mob_ref_to_attr_hash` method. In order to support the
new `path` attribute, this patch also adds a new `get_folder_path` method
to the `list_virtual_machines` vsphere module.
This commit is contained in:
Carl Caum 2011-10-28 10:10:37 -04:00 committed by Kelsey Hightower
parent b53416abce
commit 762aa624ac
3 changed files with 9 additions and 0 deletions

View file

@ -58,6 +58,7 @@ module Fog
attrs['mo_ref'] = vm_mob_ref._ref
attrs['hypervisor'] = attrs['host'].name
attrs['mac_addresses'] = vm_mob_ref.macs
attrs['path'] = get_folder_path(vm_mob_ref.parent)
end
end

View file

@ -33,6 +33,7 @@ module Fog
attribute :is_a_template
attribute :connection_state
attribute :mo_ref
attribute :path
def start(options = {})
requires :instance_uuid

View file

@ -75,6 +75,13 @@ module Fog
end
results.flatten
end
def get_folder_path(folder, root = nil)
if ( not folder.methods.include?('parent') ) or ( folder == root )
return
end
"#{get_folder_path(folder.parent)}/#{folder.name}"
end
end
class Mock