CiscoDevNet / intersight-powershell

Cisco Intersight PowerShell
Apache License 2.0
16 stars 4 forks source link

New-IntersightBulkRequest fails with 'New-IntersightBulkRequest: Object reference not set to an instance of an object.' after module upgrade to 1.0.11.14430 and higher #139

Closed briamorr closed 3 months ago

briamorr commented 9 months ago

Describe the bug

New-IntersightBulkRequest fails with 'New-IntersightBulkRequest: Object reference not set to an instance of an object.' after module upgrade to 1.0.11.14430 and higher

Existing code example works with: 1.0.11.12738, 1.0.11.13892

Existing code example doesn't work with: 1.0.11.14968, 1.0.11.14430

PowerShell 7.3.11

To Reproduce

$org = Get-IntersightOrganizationOrganization -Name "default"
$fabricEthNetworkPolicy = Get-IntersightFabricEthNetworkPolicy -Name "briamorr-vlan" -Organization $org | Get-IntersightMoMoRef
$fabricMulticastPolicy = Get-IntersightFabricMulticastPolicy -Name "briamorr-multicast" -Organization $org  | Get-IntersightMoMoRef

$request = New-Object -TypeName "System.Collections.ArrayList"
$request = [System.Collections.ArrayList]@()

$VlanForFabric=5,11,18,40,47,49,54,58,61,202,204,224,238,777,778,901,905,1010,1011,1012,1013,1014,1031,1065,1067,1249,1299,1300,1304,1630

foreach($vlan in $VlanForFabric){
    $additionalProps = Initialize-IntersightFabricVlan -Name ("vlan_"+$vlan) -VlanId $vlan -EthNetworkPolicy $fabricEthNetworkPolicy -MulticastPolicy $fabricMulticastPolicy -SharingType None -AutoAllowOnUplinks $true
    $additionalPropsObj = New-Object System.Collections.Generic.Dictionary"[String,Object]"
    $additionalPropsObj.Add("Body",$additionalProps)
    $request += Initialize-IntersightBulkSubRequest -Verb "POST" -Uri "/v1/fabric/Vlans" -AdditionalProperties $additionalPropsObj
}

New-IntersightBulkRequest -Requests $request 

Version used Powershell Module 1.0.11.14430+ Powershell 7.3.11 Intersight SaaS

Expected behavior Backwards compatibility

Additional Context

>New-IntersightBulkRequest -Requests $request

New-IntersightBulkRequest: Object reference not set to an instance of an object.

>$error[0].Exception

TargetSite     : Void ProcessRecord()
Message        : Object reference not set to an instance of an object.
Data           : {}
InnerException :
HelpLink       :
Source         : Intersight.PowerShell
HResult        : -2147467261
StackTrace     :    at Intersight.PowerShell.NewCmdletBase.ProcessRecord() in /home/jenkins/workspace/Release-IS-Powers
                 hell-Module/src/github.com/cisco-intersight/powershell-generator-intersight/generated/Intersight.Power
                 Shell_1.0.11.14430/src/CmdletBase/NewCmdletBase.cs:line 88
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
vvb commented 3 months ago

ETA - 08/16

Ghufz commented 3 months ago

This issue has been fixed in the Intersight.PowerShell version 1.0.11.17956.