CF 4.2 prov.set_folder do not set :placement_folder_name content


In CF 4.2 (docker) , with vmware 5.5 provider:

In automate:
In our “Infrastructure / VM / Provisioning / StateMachines / Methods / vmware_PreProvision” method, slightly modified,

In the “if set_folder” block:

this call: prov.set_folder(myvariable)

do not change prov :placement_folder_name contents , which returns nil, nil

(myvariable is not null and contains valid vmware folder"

What could be the problem origin ?



Is myvariable the text string name of the folder, or the service model object for the folder?

If the former, you’ll need to lookup the service model object using something like:

folder_obj = $evm.vmdb(:EmsFolder).find_by_name("My Folder Name")
prov.set_folder(folder_obj) unless folder_obj.nil?

Hope this helps,


You can also use the prov.eligible_folders method which returns folder objects. Once you find the one you want you can use that object in the call to prov.set_folder.




myvariable contains a string.
We have 3 datacenters and folders in these datacenters.

The string contains “datacenter2/folderX”.

eligible_folders list well all the strings (inside ’ <" "> ’ chars although.



The argument to prov.set_folder must be a service model object, not a string, I think this might be the problem. You need to look up the service model object using $evm.vmdb, then pass this as the argument.

Hope this helps,


@pemcg The set_folder method was one of the earliest set_* methods and it initially supported a string parameter and we have maintained that functionality. The more current usage is to pass an object, but wanted to let you know the string format is not invalid.

You can see more details about the backend method here:


Interesting to know, thanks Greg