Skip to content

Set-ToolsRepo: Allow older VM Tools uploads without modifying metadata.json#385

Merged
Kavyareddyguntaka11 merged 8 commits intomainfrom
kguntaka/36884736
Apr 3, 2026
Merged

Set-ToolsRepo: Allow older VM Tools uploads without modifying metadata.json#385
Kavyareddyguntaka11 merged 8 commits intomainfrom
kguntaka/36884736

Conversation

@Kavyareddyguntaka11
Copy link
Copy Markdown
Contributor

@Kavyareddyguntaka11 Kavyareddyguntaka11 commented Apr 1, 2026

This PR re-creates the previously approved changes from #375 using a personal branch in the Azure repository, as fork-based PRs do not run CI.

Summary

This change updates the Set-ToolsRepo run command behavior to allow uploading older VM Tools versions without modifying metadata.json, while still preserving the latest version metadata.

Changes

  • Allows upload of older VM Tools versions without impacting metadata.json
  • Ensures the latest version information remains intact
  • Improves datastore browse path handling and validation logic
  • Includes reviewer-requested fixes and refinements
  • Adds unit tests covering the updated metadata behavior

Validation

  • Existing unit tests pass
  • New unit tests added for metadata behavior
  • Behavior verified to preserve latest VM Tools metadata

Additional Changes

  • Only check real VMware Tools version folders so other files don’t affect metadata updates.
  • Fail the run command clearly if any host setup fails, instead of reporting partial success.
  • Fix tests to correctly verify older version uploads without changing the main metadata file.
  • Fixed test paths to use $TestDrive for Linux CI.
  • Added proxy function to mock Get-EsxCli without PowerCLI type errors.
  • Added PSIsContainer to mock objects so version comparison works correctly.
  • Fixed assertion to match actual Copy-DatastoreItem destination.
  • Set TEMP/TMP to $TestDrive so tests work cross-platform.
  • Removed Classes.ps1 import that came in from merge, not part of this PR.

This PR replaces the earlier fork-based PR (#375) with the same functionality, following the recommended Azure repo workflow.

…tadata only when the latest version is uploaded
1: Removed forced PowerShell progress setting.

2: Removed temp directory cleanup logic.

3: Fixed rooted archive path issue when discovering vmtools folder.

4: Normalized archive path and unified datastore destination path building.

5: Ensured top-level GuestStore artifacts are copied (metadata.json update rules unchanged).
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Set-ToolsRepo (Microsoft.AVS.Management run command) to allow uploading older VMware Tools versions without overwriting the top-level metadata.json, while keeping the “latest version” metadata behavior intact. Adds/updates Pester coverage to validate the new metadata decision logic.

Changes:

  • Adjusts Set-ToolsRepo copy/metadata logic to only overwrite top-level metadata.json when the incoming version is greater than the existing highest version.
  • Improves path handling for extracted archive paths and datastore browsing.
  • Adds mock-only Pester tests to validate “older vs newer vs existing version” behaviors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Microsoft.AVS.Management/Microsoft.AVS.Management.psm1 Updates Set-ToolsRepo logic for version comparison, selective metadata overwrite, datastore browse path usage, and refactors copy flow.
tests/Microsoft.AVS.Management.Tests.ps1 Adds mocks/types needed for module import and introduces InModuleScope mock-only tests around version/metadata decision logic.

@Kavyareddyguntaka11
Copy link
Copy Markdown
Contributor Author

Kavyareddyguntaka11 commented Apr 1, 2026

@microsoft-github-policy-service agree

@Kavyareddyguntaka11 Kavyareddyguntaka11 merged commit 5d537d4 into main Apr 3, 2026
10 checks passed
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.

3 participants