I'm ceating a vRO python script to create vm snapshot,
I used composite type to select vm from vcenter.
As I got errors, I only tested to print the input values are correct
Code:
from pyVmomi import vim
def handler(context, inputs):
print(inputs)
print(context)
vm_n = inputs['vmName']
s_s_n = inputs['sn_name']
d = inputs['description']
print (vm_n, s_s_n, d)

I got the following log:
2024-10-07 13:01:04.909 +03:00info__item_stack:/item1
2024-10-07 13:01:08.723 +03:00info{'sn_name': 'vro', 'description': 'this snapshot was created by vRO'}
2024-10-07 13:01:08.724 +03:00info{'executionId': '3188fb5c-e51f-49f0-be0b-648826ef02e0', 'returnType': None, 'vcoUrl': 'http://localhost:8280/vco', 'getToken': <function getTokenFactory.<locals>.getToken at 0x7f38ce5b9c60>}
2024-10-07 13:01:08.725 +03:00errorTraceback (most recent call last):
2024-10-07 13:01:08.729 +03:00error File "/run/vco-polyglot/index.py", line 110, in <module>
2024-10-07 13:01:08.730 +03:00error ret = handler(context, inputs)
2024-10-07 13:01:08.731 +03:00error File "/run/vco-polyglot/function/handler.py", line 8, in handler
2024-10-07 13:01:08.732 +03:00error vm_n = inputs['vmName']
2024-10-07 13:01:08.733 +03:00errorKeyError: 'vmName'
2024-10-07 13:01:09.833 +03:00errorError in (Workflow:create vm snapshot with python / Scriptable task (item1)#12759) Wrapped ch.dunes.scripting.server.polyglot.PolyglotRunnerException: 'vmName'
2024-10-07 13:01:09.880 +03:00errorWorkflow execution stack: *** item: 'create vm snapshot with python/item1', state: 'failed', business state: 'null', exception: 'Wrapped ch.dunes.scripting.server.polyglot.PolyglotRunnerException: 'vmName' (Workflow:create vm snapshot with python / Scriptable task (item1)#12759)' workflow: 'create vm snapshot with python' (70b213d4-e274-443f-8ea9-8035369e5c8f) | 'attribute': name=vm_name_tmp type=string value= | 'input': name=vmName type=VC:VirtualMachine value=dunes://service.dunes.ch/CustomSDKObject?id='10.34.12.20%2Cid:vm-25486'&dunesName='VC:VirtualMachine' | 'input': name=sn_name type=string value=vro | 'input': name=description type=string value=this snapshot was created by vRO | 'output': name=snapshotName type=string value=null *** End of execution stack.
Any advice how to use composite type in python script?
Thanks