CF 4.2 prov.set_folder do not set :placement_folder_name content


#1

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 ?


#2

Hi

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,
pemcg


#3

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.


#4

Hi,

@pemcg
@gmccullough

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.


#5

Hi

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


#6

@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: https://github.com/ManageIQ/manageiq/blob/master/app/models/mixins/miq_provision_mixin.rb#L140


#7

Interesting to know, thanks Greg


#8

Hi,

With CFME 5.9.2.4, even if the documentation describes that can be used a string “datacenter/folder1/folder2/” and an object :

set_folder(folder_path)

Set the folder to use based on object returned from eligible_folders. In addition, set_folder accepts the following folder types:

Folder Paths - separated by forward slashes. (Must include Data-center name.) Example: Prod/Discovered virtual machine where Prod is the Data-center name and Discovered virtual machine is the folder name.

Object returned from the get_folder_paths method

The reality is that the string is not working :

> The following error occurred during instance method <set_folder> for AR object <#<ManageIQ::Providers::Vmware::InfraManager::Provision id:

Is that the expected behavior on 4.6??

BR.


#9

You should report CF bugs in Bugzilla.