Add find_folder method details

Specifically that the 3rd argument datacentername supports a 'nil' value, in which case the first datacenter is returned.
This commit is contained in:
Samuel 2017-06-20 15:08:39 +01:00 committed by Glenn Sarti
parent 7077eadc65
commit 5355d1cf03

View file

@ -510,6 +510,12 @@ module Vmpooler
available_unit_numbers.sort[0]
end
# Finds the first reference to and returns the folder object for a foldername and an optional datacenter
# Params:
# +foldername+:: the folder to find (optionally with / in which case the foldername will be split and each element searched for)
# +connection+:: the vsphere connection object
# +datacentername+:: the datacenter where the folder resides, or nil to return the first datacenter found
# returns a ManagedObjectReference for the first folder found or nil if none found
def find_folder(foldername, connection, datacentername)
datacenter = connection.serviceInstance.find_datacenter(datacentername)
raise("Datacenter #{datacentername} does not exist") if datacenter.nil?