From 5355d1cf03a80d75366630589aa2fe2b9ba36878 Mon Sep 17 00:00:00 2001 From: Samuel Date: Tue, 20 Jun 2017 15:08:39 +0100 Subject: [PATCH] Add find_folder method details Specifically that the 3rd argument datacentername supports a 'nil' value, in which case the first datacenter is returned. --- lib/vmpooler/providers/vsphere.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/vmpooler/providers/vsphere.rb b/lib/vmpooler/providers/vsphere.rb index 88be86d..072e1db 100644 --- a/lib/vmpooler/providers/vsphere.rb +++ b/lib/vmpooler/providers/vsphere.rb @@ -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?