Structured path with VMFolders

Hi,

I have created an option list which queries the zone (cloud) for vm folders and it works, however the contents outputted is just flat.

Is it possible with translation scripts, to include the parent path and the folder name?

image

So it would show TEST BUILDS/JH or TEST BUILDS/ML

We are using Ansible to take the results of the input and move the VM to the required folder. However it’s failing with subfolders as the result of the input is the end folder not with subfolder.

Ie it’s trying to move the VM to JH but needs TESTBUILDS/JH as part of the path.

Ideally we need the name and value to specify the parent path as well.

Is this possible?

Thanks
Jon

I don’t have anything off hand, but in theory as long as the parent path or id comes back in the api you should be able to do something like:

results.push({name: data.folders[i].parent + ' \ ' + data.folders[i].name, value: data.folders[i].name})

That said, if you are using forms we have this natively now and you could just consume that:

Thanks, managed to get one level of folders with:

for(i in data.folders){
if (data.folders[i].parent != (null)){
if (data.folders[i].parent.name != ‘/’){
results.push({name: data.folders[i].parent.name + ‘/’ + data.folders[i].name, value: data.folders[i].parent.name + ‘/’ + data.folders[i].name});
}
else if (data.folders[i].parent.name == ‘/’){
results.push({name: data.folders[i].name, value: data.folders[i].name});
}
}}

But not too sure how to link the previous parent. Is it possible?

For example it should be HOOS-WIN/TEST BUILDS/JH

Unfortunately we had issues with an upgrade to 6.1 and the catalog broke. So we have had to stay on the current release.