Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Create a dynamic list of vCenter 6.5 Folders for vRA 7.2

$
0
0

I need to have a drop down on my vRA blueprints that will list the folders in vCenter allowing the user to specify which one they want to build their VM in.  I can manually input the folder list as a Property Definition however our operations group creates quite a number of folders.  What I would like to do is call a vRO workflow that will dynamically build this list for me so its not updated almost daily.

 

I found this code from an earlier post by Ilian Iliev

 

  1. // Search index object for the first registered vCenter 
  2. var index = VcPlugin.allSdkConnections[0].searchIndex; 
  3.  
  4. // Inventory path of the folder to search for (note: starts with datacenter name; replace datacenter123 with your datacenter name) 
  5. var invPath = "/datacenter123/vm/site1/servers/critical/"
  6.  
  7. var folder = index.findByInventoryPath(invPath); 
  8. System.log("folder: " + folder); 

 

I did change the DC name to /mydatacenter/mycluster/ under which I have several top level folders and subfolders.  When I run this workflow I get the following error message in vRO. I have tried this by declaring invPath as an attribute and hardcoding the datacenter and added folder as an output.  I seem to have no luck either way.

 

[2017-07-20 09:15:44.132] [E] Error in (Workflow:getFolderList / Scriptable task (item1)#6) TypeError: Cannot call method "findByInventoryPath" of null

[2017-07-20 09:15:44.140] [E] Workflow execution stack:

***

item: 'getFolderList/item1', state: 'failed', business state: 'null', exception: 'TypeError: Cannot call method "findByInventoryPath" of null (Workflow:getFolderList / Scriptable task (item1)#6)'

workflow: 'getFolderList' (16cedf47-3abc-4e1b-ba60-e390b995e1bc)

|  'attribute': name=invPath type=string value=/p10dcvcenterha.amwins.local/P10/

|  'output': name=folder type=string value=null

|  'no inputs'

*** End of execution stack.

 

Any assistance would be great. 

Thanks


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>