VMware Cloud Community
philk33
Enthusiast
Enthusiast
Jump to solution

Trouble Copying File from VCO to Guest while using Attribute that is an Array

I'm getting an error message when trying to pass an array of VM names form a folder to the "For Each Copy File from VCO to Guest" workflow.

[2018-01-23 16:10:25.755] [E] Workflow execution stack:

***

item: 'Copy All Files To Parent VMs/item2', state: 'failed', business state: 'null', exception: 'java.lang.IllegalArgumentException: Iteration over multiple arrays requires that they have the same length: vm'

workflow: 'Copy All Files To Parent VMs' (0cceadcc-3853-44f3-9131-76dd9ec8a04f)

|  'attribute': name=vmFolder type=VC:VmFolder value=dunes://service.dunes.ch/CustomSDKObject?id='shqvmwap65.cabelas.corp/group-v4701'&dunesName='VC:VmFolder'

|  'attribute': name=VMList type=Array/VC:VirtualMachine value=#{#VC:VirtualMachine#dunes://service.dunes.ch/CustomSDKObject?id='shqvmwap65.cabelas.corp/vm-1343'&dunesName='VC:VirtualMachine'#;#VC:VirtualMachine#dunes://service.dunes.ch/CustomSDKObject?id='shqvmwap65.cabelas.corp/vm-8774'&dunesName='VC:VirtualMachine'#;#VC:VirtualMachine#dunes://service.dunes.ch/CustomSDKObject?id='shqvmwap65.cabelas.corp/vm-5446'&dunesName='VC:VirtualMachine'#;#VC:VirtualMachine#dunes://service.dunes.ch/CustomSDKObject?id='shqvmwap65.cabelas.corp/vm-9429'&dunesName='VC:VirtualMachine'#;#VC:VirtualMachine#dunes://service.dunes.ch/CustomSDKObject?id='shqvmwap65.cabelas.corp/vm-8770'&dunesName='VC:VirtualMachine'#;#VC:VirtualMachine#dunes://service.dunes.ch/CustomSDKObject?id='shqvmwap65.cabelas.corp/vm-6103'&dunesName='VC:VirtualMachine'#}#

|  'attribute': name=vmUsername type=Array/string value=#{#string#Admin#}#

|  'attribute': name=vmPassword type=Array/SecureString value=#{#Any#__NULL__#}#

|  'attribute': name=vcoPath type=Array/string value=#{#string#/opt/vcofiles/1-EnableWindowsUpdate.bat#}#

|  'attribute': name=guestFilePath type=Array/string value=#{#string#C:\#}#

|  'attribute': name=overwrite type=Array/boolean value=#{#boolean#true#}#

|  'output': name=actionResult type=Array/VC:VirtualMachine value=null

|  'output': name=var type=Array/boolean value=null

|  'no inputs'

*** End of execution stack.

Here are my Visual Bindings:

For getAllVirtualMachine Element:

pastedImage_1.png

Foreach (Copy file) Workflow:

pastedImage_2.png

Main workflow Schema:

pastedImage_3.png

Is this just not possible? I don't want to use Powercli to copy files since I want to encrypt the parent VM's credentials. I need to pass multiple files over to the parent VM's during patching.

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

It's certainly possible Smiley Happy The problem is that your list of VMs contains 6 elements, but other parameters like username, password, path, etc. are arrays containing a single element.

So there are two cases:

1) You want every iteration to call the copy workflow for each of the VMs, and you want to pass specific username, password, etc. for this particular VM. In this case, username, password, and other parameters should be arrays (as in your case) but these arrays must have the same number of elements as the array with VMs. So the first iteration will execute the copy workflow using the elements at index 0 from each list, the second iteration will use elements at index 1, etc.

2) You want every iteration to call the copy workflow for each of the VMs, but other parameters like username, password and path will be always the same for all VMs. In this case, these other parameters must not be arrays but singular elements; eg instead of type Array/string you should use just string.

Hopefully the above makes sense Smiley Happy

View solution in original post

Reply
0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

It's certainly possible Smiley Happy The problem is that your list of VMs contains 6 elements, but other parameters like username, password, path, etc. are arrays containing a single element.

So there are two cases:

1) You want every iteration to call the copy workflow for each of the VMs, and you want to pass specific username, password, etc. for this particular VM. In this case, username, password, and other parameters should be arrays (as in your case) but these arrays must have the same number of elements as the array with VMs. So the first iteration will execute the copy workflow using the elements at index 0 from each list, the second iteration will use elements at index 1, etc.

2) You want every iteration to call the copy workflow for each of the VMs, but other parameters like username, password and path will be always the same for all VMs. In this case, these other parameters must not be arrays but singular elements; eg instead of type Array/string you should use just string.

Hopefully the above makes sense Smiley Happy

Reply
0 Kudos
philk33
Enthusiast
Enthusiast
Jump to solution

Option 2 worked for me. I guess you cannot change attributes to type string from array in the General Tab. You have to create new attributes and assign them as input variables on the specific workflow edit tab.

Thanks

Reply
0 Kudos