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:
parent
b53416abce
commit
762aa624ac
3 changed files with 9 additions and 0 deletions
|
@ -58,6 +58,7 @@ module Fog
|
||||||
attrs['mo_ref'] = vm_mob_ref._ref
|
attrs['mo_ref'] = vm_mob_ref._ref
|
||||||
attrs['hypervisor'] = attrs['host'].name
|
attrs['hypervisor'] = attrs['host'].name
|
||||||
attrs['mac_addresses'] = vm_mob_ref.macs
|
attrs['mac_addresses'] = vm_mob_ref.macs
|
||||||
|
attrs['path'] = get_folder_path(vm_mob_ref.parent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ module Fog
|
||||||
attribute :is_a_template
|
attribute :is_a_template
|
||||||
attribute :connection_state
|
attribute :connection_state
|
||||||
attribute :mo_ref
|
attribute :mo_ref
|
||||||
|
attribute :path
|
||||||
|
|
||||||
def start(options = {})
|
def start(options = {})
|
||||||
requires :instance_uuid
|
requires :instance_uuid
|
||||||
|
|
|
@ -75,6 +75,13 @@ module Fog
|
||||||
end
|
end
|
||||||
results.flatten
|
results.flatten
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
|
Loading…
Reference in a new issue