Skip to content

Commit

Permalink
fix: remove sos elements based on version
Browse files Browse the repository at this point in the history
- Updated `Request-SoSHealthJson` to only include both `precheckReport` and `versionHealth` from the SoS API request payload if the version is VMware Cloud Foundatin 4.5.0 or later.
- Updated `CHANGELOG.md`.
- Updated the module build from v2.0.0.1013 to v2.0.1.1000.
- Updated the module GUID.
- Updated the module release date.

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
tenthirtyam committed May 11, 2023
1 parent 4b42c50 commit e7c3e5a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

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

> Release Date: 2023-05-12
Bug Fixes:

- Updated `Request-SoSHealthJson` to omit the `precheckReport` and `versionHealth` from the SoS API request payload if the version is not VMware Cloud Foundatin 4.5.0 or later.

## [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
6 changes: 3 additions & 3 deletions VMware.CloudFoundation.Reporting.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Gary Blake, Cloud Infrastructure Business Group (CIBG)
#
# Generated on: 04/25/2023
# Generated on: 05/12/2023
#

@{
Expand All @@ -12,13 +12,13 @@
RootModule = '.\VMware.CloudFoundation.Reporting.psm1'

# Version number of this module.
ModuleVersion = '2.0.0.1013'
ModuleVersion = '2.0.1.1000'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '603813a8-4f36-424a-be6a-f2914f987961'
GUID = 'd79c29fa-3db9-4d62-b02b-3c020222eaf7'

# Author of this module
Author = 'Gary Blake, Ryan Johnson, Ivaylo Ivanov, Antony Stefanov - Cloud Infrastructure Business Group (CIBG)'
Expand Down
19 changes: 12 additions & 7 deletions VMware.CloudFoundation.Reporting.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ Function Invoke-VcfHealthReport {
$failureOnlySwitch = " -failureOnly"
}

$vcfVersion = ((Get-VCFManager).version).Split('-')[0]

Start-SetupLogFile -Path $reportPath -ScriptName $MyInvocation.MyCommand.Name # Setup Log Location and Log File
Write-LogMessage -Type INFO -Message "Starting the process of creating a Health Report for $workflowMessage." -Colour Yellow
Write-LogMessage -Type INFO -Message "Setting up the log file to path $logfile."
Expand All @@ -126,8 +128,10 @@ Function Invoke-VcfHealthReport {
$serviceHtml = Invoke-Expression "Publish-ServiceHealth -json $jsonFilePath -html $($failureOnlySwitch)"; $reportData += $serviceHtml

# Generating the Version Health Data Using the SoS Data
Write-LogMessage -Type INFO -Message "Generating the Version Health Report using the SoS output for $workflowMessage."
$versionHtml = Invoke-Expression "Publish-VersionHealth -json $jsonFilePath -html $($failureOnlySwitch)"; $reportData += $versionHtml
if ($vcfVersion -ge "4.5.0") {
Write-LogMessage -Type INFO -Message "Generating the Version Health Report using the SoS output for $workflowMessage."
$versionHtml = Invoke-Expression "Publish-VersionHealth -json $jsonFilePath -html $($failureOnlySwitch)"; $reportData += $versionHtml
}

# Generating the Connectivity Health Data Using SoS Data and Supplemental PowerShell Request Functions
Write-LogMessage -Type INFO -Message "Generating the Connectivity Health Report using the SoS output for $workflowMessage."
Expand Down Expand Up @@ -687,6 +691,10 @@ Function Request-SoSHealthJson {
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)

# Request VCF Token
Request-VCFToken -fqdn $server -Username $user -Password $pass -skipCertificateCheck -ErrorAction SilentlyContinue -ErrorVariable ErrMsg | Out-Null
$vcfVersion = ((Get-VCFManager).version).Split('-')[0]

# Build Default Health Summary Check POST payload
$healthChecksPayload = New-Object -TypeName psobject
$healthChecksPayload | Add-Member -notepropertyname 'certificateHealth' -notepropertyvalue $true
Expand All @@ -700,12 +708,12 @@ Function Request-SoSHealthJson {
$healthChecksPayload | Add-Member -notepropertyname 'passwordHealth' -notepropertyvalue $true
$healthChecksPayload | Add-Member -notepropertyname 'servicesHealth' -notepropertyvalue $true
$healthChecksPayload | Add-Member -notepropertyname 'storageHealth' -notepropertyvalue $true
$healthChecksPayload | Add-Member -notepropertyname 'versionHealth' -notepropertyvalue $true
if ($vcfVersion -ge "4.5.0") { $healthChecksPayload | Add-Member -notepropertyname 'versionHealth' -notepropertyvalue $true }
$optionsConfigPayload = New-Object -TypeName psobject
$optionsConfigPayload | Add-Member -notepropertyname 'force' -notepropertyvalue $false
$optionsConfigPayload | Add-Member -notepropertyname 'skipKnownHostCheck' -notepropertyvalue $true
$optionsIncludePayload = New-Object -TypeName psobject
$optionsIncludePayload | Add-Member -notepropertyname 'precheckReport' -notepropertyvalue $false
if ($vcfVersion -ge "4.5.0") { $optionsIncludePayload | Add-Member -notepropertyname 'precheckReport' -notepropertyvalue $false }
$optionsIncludePayload | Add-Member -notepropertyname 'summaryReport' -notepropertyvalue $false
$optionsPayload = New-Object -TypeName psobject
$optionsPayload | Add-Member -notepropertyname 'config' -notepropertyvalue $optionsConfigPayload
Expand All @@ -726,9 +734,6 @@ Function Request-SoSHealthJson {
$healthSummarySpec | Add-Member -notepropertyname 'options' -notepropertyvalue $optionsPayload
$healthSummarySpec | Add-Member -notepropertyname 'scope' -notepropertyvalue $scopePayload

# Request VCF Token
Request-VCFToken -fqdn $server -Username $user -Password $pass -skipCertificateCheck -ErrorAction SilentlyContinue -ErrorVariable ErrMsg | Out-Null

Try {
if ($PsBoundParameters.ContainsKey("allDomains")) {
$healthSummarySpec.scope.includeAllDomains = $true
Expand Down

0 comments on commit e7c3e5a

Please sign in to comment.