HewlettPackard / POSH-HPEOneView

PowerShell language bindings library for HPE OneView.
http://hewlettpackard.github.io/POSH-HPEOneView/
126 stars 52 forks source link

Get-HPOVBaseline Duplicate Key Error #574

Closed j-crawford17 closed 2 years ago

j-crawford17 commented 3 years ago

When running the Get-HPOVBaseline commandlet, I'll get the following error

Get-HPOVBaseline : Cannot convert the JSON string because a dictionary that was converted from the string contains the
duplicated keys 'HPE Ethernet 100Gb 2-Port QSFP56 MCX623106AS-CDAT Adapter' and 'HPE Ethernet 100Gb 2-port QSFP56
MCX623106AS-CDAT Adapter'.
At line:1 char:18
+ $sppCollection = Get-HPOVBaseline
+                  ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-HPOVBaseline], InvalidOperationException
    + FullyQualifiedErrorId : DuplicateKeysInJsonString,Get-HPOVBaseline

Using Module - HPOneview.500

Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      2736   1630

Error only occurs on OneView 5.00.02. Seems to run fine on OneView 5.30 and above.

ChrisLynchHPE commented 3 years ago

This is caused by the SPP/SSP containing multiple, duplicate keys, which PowerShell/C# does not allow. Yes, this is fixed in newer versions of the library. Unfortunately, the 5.00 library is no longer supported here. Please update your use of the library and OneView to a current release.

jacobhopkins117 commented 3 years ago

Hey Chris - Unfortunately we're currently blocked from upgrading beyond 5.00 due to a00101430en_us until our engineers can finalize upgrading the Emulex firmware on hundreds of production systems. Are you aware of a workaround to get our ~300 Server Profile Templates modified?

ChrisLynchHPE commented 3 years ago

Yes. You can always natively edit the resource objects directly. For instance, use the following:

$BaselinesUri = "/rest/firmware-drivers"
$Baselines = Send-HPOVRequest -Uri $BaselinesUri

$Baseline = $Baselines.members | Where name -eq "Baseline Name"

$SPT = Get-HPOVServerProfileTemplate -Name MyTemplateName

$SPT.firmware.firmwareBaselineUri = $Baseline.uri

# Specify one value:  "FirmwareOnly", "FirmwareAndOSDrivers", or "FirmwareOnlyOfflineMode"
$SPT.firmware.firmwareInstallType = "FirmwareOnly"
$SPT.firmware.firmwareActivationType = "Immediate"
Save-HPOVServerProfileTemplate -InputObject $SPT | Wait-HPOVTaskComplete
jacobhopkins117 commented 3 years ago

Great! Thank you for the follow up.

ChrisLynchHPE commented 2 years ago

Closing due to no further activity.