Skip to content

Improvements and corrections to Set-ToolsRepo and additional formatting. #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

calcobia
Copy link

This PR closes #

The changes in this PR are as follows:

  • Fixed null variable checks in Set-ToolsRepo function.
  • Improved version check with semantic version comparison instead of lexicographical comparison.
  • Fixed path error that prevented files from being copied.
  • Additional error handling
  • General formatting

I have read the contributor guidelines and have completed the following:

  • Formatted the code using VSCode default formatter for PowerShell.
  • Tested the code end-to-end against an SDDC.
  • Documented the functions using standard PowerShell markup and applied AVSAttribute to newly exported functions.

Fixed version check by replacing an unsupported ternary conditional operator with the equivalent if statement.
Fixed the path error that would cause the files to not be copied.
Copy link
Author

@calcobia calcobia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before - A simple string comparison

$OldVersion = "10.9.30"
$NewVersion = "10.10.30"
If ($NewVersion -ge $OldVersion) {"New version is newer."} else {"New version is older"}
New version is older
Returns the wrong result.

Now - Semantic version comparison

$OldVersion = [System.Version]::Parse("10.9.30")
$NewVersion = [System.Version]::Parse("10.10.30")
If ($NewVersion -ge $OldVersion) {"New version is newer."} else {"New version is older"}
New version is newer.
Returns the correct result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant