Hey. I'm using PowerCLI 12.0.0, and I have an issue with a script that is used to Import/Export templates between vCenters.
I am using Export-Vapp to export the template to an OVA, and then have logic to map the configuration appropriately to the destination and use Import-Vapp to perform the import.
At one point in my script, I am using Get-OvfConfiguration to retrieve the NetworkMapping of the template, and map the network before Importing the template to the destination.
The problem I am running into is that I have network names that include DOTS, e.g. VC_Automation_Net-Mgmt_10.10.10.10_23
So when the Get-OvfConfiguration runs, the NetworkMapping is truncated, and the associated object is malformed, making it (seemingly) impossible to map the network for the destination and perform the Import-Vapp. I have inspected the OVA file, and the network is represented correctly in the XML (dots and all).
This has worked fine for months with non-dotted networks, but due to some Lifecycle management, I have had to move my image processes to a different cluster, and this is the hand I have been dealt. Is this a bug? Is there a workaround? At this point, renaming the networks does not appear to be a solution... Any ideas would be greatly appreciated.
D:\ovatemp> Get-OvfConfiguration -Ovf D:\ovatemp\w2k12r2-ehc-202008-temp.ova | select -ExpandProperty NetworkMapping
VC_Automation_Net-Mgmt_10
-------------------------
System.Object
Can you check what this returns?
$ovfConfig.PSBase.Item('NetworkMapping')
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm getting the following. But to be fair, I get the same with an OVA without dots...
D:\ovatemp> $ovfConfig = Get-OvfConfiguration -Ovf D:\ovatemp\w2k12r2-ehc-202008-temp.ova
D:\ovatemp> $ovfConfig.PSBase.Item('NetworkMapping')
Method invocation failed because [System.Management.Automation.PSInternalMemberSet] does not contain a method named
'Item'.
At line:1 char:1
+ $ovfConfig.PSBase.Item('NetworkMapping')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Item:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Ok, and does this return anything?
I just want to establish if the issue already happened during the reading of the XML or when displaying/referring the content
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Now we're on to something...
class Object
{
VC_Automation_Net-Mgmt_10 =
class Object
{
10 =
class Object
{
10 =
class Object
{
10_23 =
class OvfPropertyImpl
{
Key = NetworkMapping.VC_Automation_Net-Mgmt_10.10.10.10_23
Value =
DefaultValue =
OvfTypeDescription = string
Description = The VC_Automation_Net-Mgmt_10.10.10.10_23 network
}
}
}
}
}
Not really I'm afraid.
From that output, it looks as if the Get-OvfConfiguration already screws up.
The dots in the networkname are apparently interpreted as PowerShell's object nested property separators, instead of as 1 string.
That looks very much like a bug in the Get-OvfConfiguration cmdlet.
You could open an SR for this (but that doesn't fix your immediate issue).
And yes, PowerCLI is supported without a Developer Support Contract, even if GSS might claim differently.
Point them to PowerCLI Support Breakdown
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
As predicted GSS started asking about our SDK entitlement, I have pointed them to the document you quoted. We'll see what happens.
Thanks.