Skip to content

Commit

Permalink
refactor: isolated workload domains
Browse files Browse the repository at this point in the history
- Updated `Request-VcenterAuthentication` to support isolated workload domains.
- Updated `Request-DatastoreStorageCapacity` to support isolated workload domains.
- Updated `CHANGELOG.md`.
- Updated module version from v2.1.0.1002 to v2.1.0.1003.

Ref: #106

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
Ryan Johnson committed Apr 25, 2023
1 parent 6d9dbbc commit 4b2050a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 26 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Enhancement:
- Updated `Invoke-VcfHealthReport` to include the hardware compatibility health using the `Publish-HardwareCompatibilityHealth` cmdlet. [GH-129](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/129)
- Added component size checks for vCenter Server instances and NSX Local Manager clusters to the overview report. [GH-130](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/130)

Refactor:

- Updated `Request-VcenterAuthentication` to support isolated workload domains. [GH-131](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/131)
- Updated `Request-DatastoreStorageCapacity` to support isolated workload domains. [GH-131](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/131)

## [v2.0.0](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/releases/tag/v2.0.0)

> Release Date: 2023-04-25
Expand Down
2 changes: 1 addition & 1 deletion VMware.CloudFoundation.Reporting.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = '.\VMware.CloudFoundation.Reporting.psm1'

# Version number of this module.
ModuleVersion = '2.1.0.1002'
ModuleVersion = '2.1.0.1003'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
53 changes: 28 additions & 25 deletions VMware.CloudFoundation.Reporting.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4341,7 +4341,7 @@ Function Request-DatastoreStorageCapacity {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
$customObject = New-Object System.Collections.ArrayList
$vcenter = (Get-VCFWorkloadDomain | Where-Object { $_.name -eq $domain }).vcenters
$vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domainType MANAGEMENT
$vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domain $domain
if (Test-VsphereConnection -server $($vcenter.fqdn)) {
if (Test-VsphereAuthentication -server $vcenter.fqdn -user $vcfVcenterDetails.ssoAdmin -pass $vcfVcenterDetails.ssoAdminPass) {
$datastores = Get-Datastore
Expand Down Expand Up @@ -4766,7 +4766,32 @@ Function Request-VcenterAuthentication {
if ($PsBoundParameters.ContainsKey("allDomains")) {
$allWorkloadDomains = Get-VCFWorkloadDomain
foreach ($domain in $allWorkloadDomains) {
if (Test-vSphereApiAuthentication -server $domain.vcenters.fqdn -user $account.username -pass $account.password) {
if (($vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domain $domain.name)) {
if (Test-vSphereApiAuthentication -server $vcfVcenterDetails.fqdn -user $vcfVcenterDetails.ssoAdmin -pass $vcfVcenterDetails.ssoAdminPass -ErrorAction SilentlyContinue) {
$alert = "GREEN"
$message = "API Connection check successful!"
} else {
$alert = "RED"
$message = "API Connection check failed!"
}
$elementObject = New-Object System.Collections.ArrayList
$elementObject = New-Object -TypeName psobject
$elementObject | Add-Member -NotePropertyName 'Component' -NotePropertyValue "vCenter"
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue $vcfVcenterDetails.fqdn
$elementObject | Add-Member -NotePropertyName 'Alert' -NotePropertyValue $alert
$elementObject | Add-Member -NotePropertyName 'Message' -NotePropertyValue $message
if ($PsBoundParameters.ContainsKey('failureOnly')) {
if (($elementObject.alert -eq 'RED')) {
$customObject += $elementObject
}
} else {
$customObject += $elementObject
}
}
}
} else {
if (($vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domain $workloadDomain)) {
if (Test-vSphereApiAuthentication -server $vcfVcenterDetails.fqdn -user $vcfVcenterDetails.ssoAdmin -pass $vcfVcenterDetails.ssoAdminPass -ErrorAction SilentlyContinue) {
$alert = "GREEN"
$message = "API Connection check successful!"
} else {
Expand All @@ -4776,7 +4801,7 @@ Function Request-VcenterAuthentication {
$elementObject = New-Object System.Collections.ArrayList
$elementObject = New-Object -TypeName psobject
$elementObject | Add-Member -NotePropertyName 'Component' -NotePropertyValue "vCenter"
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue $domain.vcenters.fqdn
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue $vcfVcenterDetails.fqdn
$elementObject | Add-Member -NotePropertyName 'Alert' -NotePropertyValue $alert
$elementObject | Add-Member -NotePropertyName 'Message' -NotePropertyValue $message
if ($PsBoundParameters.ContainsKey('failureOnly')) {
Expand All @@ -4787,28 +4812,6 @@ Function Request-VcenterAuthentication {
$customObject += $elementObject
}
}
} else {
$vcenter = (Get-VCFWorkloadDomain | Where-Object {$_.name -eq $workloadDomain}).vcenters.fqdn
if (Test-vSphereApiAuthentication -server $vcenter -user $account.username -pass $account.password) {
$alert = "GREEN"
$message = "API Connection check successful!"
} else {
$alert = "RED"
$message = "API Connection check failed!"
}
$elementObject = New-Object System.Collections.ArrayList
$elementObject = New-Object -TypeName psobject
$elementObject | Add-Member -NotePropertyName 'Component' -NotePropertyValue "vCenter"
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue $vcenter
$elementObject | Add-Member -NotePropertyName 'Alert' -NotePropertyValue $alert
$elementObject | Add-Member -NotePropertyName 'Message' -NotePropertyValue $message
if ($PsBoundParameters.ContainsKey('failureOnly')) {
if (($elementObject.alert -eq 'RED')) {
$customObject += $elementObject
}
} else {
$customObject += $elementObject
}
}
$customObject | Sort-Object Component, Resource
}
Expand Down

0 comments on commit 4b2050a

Please sign in to comment.