vmware / powershell-module-for-vmware-cloud-foundation-power-management

PowerShell Module for VMware Cloud Foundation Power Management
https://vmware.github.io/powershell-module-for-vmware-cloud-foundation-power-management/
BSD 2-Clause "Simplified" License
10 stars 8 forks source link

`Test-NetConnection` is not valid for Powershell 7 #84

Closed burnsjared0415 closed 10 months ago

burnsjared0415 commented 10 months ago

Code of Conduct

VMware Cloud Foundation

5.0.0.0

PowerShell Version

Core Powershell 7.3.11

PowerCLI Version

13.2.1.22851661

Module Version

lastest

PowerVCF Version

2.4.1.1000

Guest Operating System

Mac

Environment Details

Environment is a VCF 5.0.0 with one Management Domain and VI domain

Description

Code is using Test-NetConnection in multiple Functions and if a customer uses Core Powershell not Desktop, customer will get errors around connection to vCenter or NSX not able to connect. This will cause errors like: ERROR Connection to 'XXXXXX' has failed. Check your environment and try again [01-16-2024_17:36:20] ERROR at Script Line 148 [01-16-2024_17:36:20] Relevant Command: Write-PowerManagementLogMessage -Type ERROR -Message "Connection to '$server' has failed. Check your environment and try again" -Colour Red [01-16-2024_17:36:20] ERROR Message: Connection to 'XXXXXXXX' has failed. Check your environment and try again

Need to update code to check Desktop vs Core on Powershell

Error or Debug Output

ERROR Connection to 'XXXXXX' has failed. Check your environment and try again [01-16-2024_17:36:20] ERROR at Script Line 148 [01-16-2024_17:36:20] Relevant Command: Write-PowerManagementLogMessage -Type ERROR -Message "Connection to '$server' has failed. Check your environment and try again" -Colour Red [01-16-2024_17:36:20] ERROR Message: Connection to 'XXXXXXXX' has failed. Check your environment and try again

Expected Behavior

INFO Connecting to 'jbvcfmgtvc01.vsanpe.vmware.com'... [01-16-2024_17:46:12] INFO Connected to server 'XXXXXXX' and attempting to shut down nodes 'XXXX'...

Actual Behavior

ERROR Connection to 'XXXXXX' has failed. Check your environment and try again [01-16-2024_17:36:20] ERROR at Script Line 148 [01-16-2024_17:36:20] Relevant Command: Write-PowerManagementLogMessage -Type ERROR -Message "Connection to '$server' has failed. Check your environment and try again" -Colour Red [01-16-2024_17:36:20] ERROR Message: Connection to 'XXXXXXXX' has failed. Check your environment and try again

Steps to Reproduce

Run any of the functions that on Test-NetConnection in a IF statement with a Core Install of Powershell

Log Fragments and Files

No response

Screenshots

No response

References

No response

tenthirtyam commented 10 months ago

We have some code in another module that will correct this issue.

burnsjared0415 commented 10 months ago

I thought we did, just did not want to make the change with out approval

tenthirtyam commented 10 months ago

Take a look at Test-EndpointConnection from PVS - we might be able to use much of the same but not require PVS for this module as a dependency.

burnsjared0415 commented 10 months ago

could we add the Test-EndpointConnection to PowerManagement and just update all Test-NetConnections to Test-EndpointConnection? we can make the Function not Export

tenthirtyam commented 10 months ago

Yea, as long as the scripts do not use it directly.

burnsjared0415 commented 10 months ago

Push with change from Test-NetConnection to Test-Endpoint Complete

github-actions[bot] commented 9 months ago

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.