Skip to content

Commit 51bddf1

Browse files
tpcarmanclaude
andcommitted
Fix null disk group crash in OSA vSAN clusters (#113)
Guard Get-VsanDisk against a null VsanDiskGroup parameter, which occurs when an OSA cluster has no claimed disks. The cluster detail table now renders correctly; Disk Groups and Disks subsections are skipped when no disk groups exist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b3eee6f commit 51bddf1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

AsBuiltReport.VMware.vSphere/Src/Private/Get-AbrVSpherevSAN.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,10 @@ function Get-AbrVSpherevSAN {
235235
# Get vSAN Disk Groups
236236
$VsanDiskGroup = Get-VsanDiskGroup -Cluster $VsanCluster.Cluster
237237
$NumVsanDiskGroup = $VsanDiskGroup.Count
238-
# Get vSAN Disks
239-
$VsanDisk = Get-VsanDisk -VsanDiskGroup $VsanDiskGroup
238+
# Get vSAN Disks (guard against null disk groups — e.g. unclaimed OSA cluster)
239+
if ($VsanDiskGroup) {
240+
$VsanDisk = Get-VsanDisk -VsanDiskGroup $VsanDiskGroup
241+
}
240242
$VsanDiskFormat = $VsanDisk.DiskFormatVersion | Select-Object -Unique
241243
# Count SSDs and HDDs
242244
$NumVsanSsd = ($VsanDisk | Where-Object { $_.IsSsd -eq $true } | Measure-Object).Count

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Fixed
1313

14+
- Fix null disk group crash in OSA vSAN clusters where disk groups have not yet been claimed ([#113](https://github.com/AsBuiltReport/AsBuiltReport.VMware.vSphere/issues/113))
1415
- Fix `An item with the same key has already been added. Key: LinkedView` error when generating TEXT format reports ([#130](https://github.com/AsBuiltReport/AsBuiltReport.VMware.vSphere/issues/130))
1516
- Fix "Index operation failed; the array index evaluated to null" crash and `Global.Licenses` privilege errors when querying ESXi host/vCenter licensing on vCenter 8.0.2 ([#123](https://github.com/AsBuiltReport/AsBuiltReport.VMware.vSphere/issues/123))
1617

0 commit comments

Comments
 (0)