Skip to content

Commit

Permalink
Add find_folder method details
Browse files Browse the repository at this point in the history
Specifically that the 3rd argument datacentername supports a 'nil' value, in which case the first datacenter is returned.
  • Loading branch information
Samuel authored and glennsarti committed Jun 20, 2017
1 parent 7077ead commit 5355d1c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/vmpooler/providers/vsphere.rb
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,12 @@ def find_disk_unit_number(vm, controller)
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?
Expand Down

0 comments on commit 5355d1c

Please sign in to comment.