Issue with a templates using the 'map_by' function to assign networks to a vm results in "Cannot deserialize value of type `ArrayList<String>` from Array value (token `JsonToken.START_ARRAY`)"
search cancel

Issue with a templates using the 'map_by' function to assign networks to a vm results in "Cannot deserialize value of type `ArrayList<String>` from Array value (token `JsonToken.START_ARRAY`)"

book

Article ID: 402513

calendar_today

Updated On:

Products

VCF Operations/Automation (formerly VMware Aria Suite)

Issue/Introduction

In Aria Automation if a blueprint has networks included in a VM using the 'map_by function then we get the following error message when trying to build a vm from that blueprint. 

Cannot deserialize value of type `ArrayList<String>` from Array value (token `JsonToken.START_ARRAY`)
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.vmware.admiral.compute.content.TemplateComputeDescription["networks"]->ArrayList[0])

Environment

Aria Automation 8.18.1 U1 and 8.18.1 U2

Resolution

This issue is targeted to be addressed in Aria Automation 9.0. As a workaround it is necessary to make sure all networks have a count property even if that count is set to 1. Here is a simple example demonstrating the necessary count field: 

formatVersion: 1
inputs: {}
resources:
  Cloud_vSphere_Network_2:
    type: Cloud.vSphere.Network
    properties:
      count: 1
      networkType: existing
  Cloud_vSphere_Network_1:
    type: Cloud.vSphere.Network
    properties:
      networkType: existing
      count: 1
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      image: test
      cpuCount: 1
      totalMemoryMB: 1024
      networks: '${map_by(resource.Cloud_vSphere_Network_1[]. + resource.Cloud_vSphere_Network_2[]., r => {"network":r.id, "assignment":"static", "deviceIndex": r.deviceIndex})}'