Skip to content

Refactor uninstall to add -purge flag #60

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

Merged
merged 1 commit into from
May 21, 2025
Merged

Refactor uninstall to add -purge flag #60

merged 1 commit into from
May 21, 2025

Conversation

TinaMor
Copy link
Contributor

@TinaMor TinaMor commented Apr 23, 2025

PR description

This PR updates the uninstall behavior to preserve user data by default. It ensures that only the binaries directory is removed during uninstallation, while keeping ProgramData and configuration files intact unless explicitly requested using the -Purge flag.

Github issue

BUG: Uninstall-Containerd too destructive #40

Background information

Previously, the uninstall command removed all directories related to the tool, including the ProgramData folder. This could unintentionally delete user-generated data, logs, or configurations.

What does this PR do

Previously, the uninstall command removed all directories related to the tool, including the ProgramData folder. This could unintentionally delete user-generated data, logs, or configurations.

This update modifies the uninstall logic to:

  • Default behavior: Remove only the binaries directory (i.e., the installed tool's core executable files).
  • Optional purge mode (-Purge): When this flag is passed, the uninstall process will delete all tool-related data — including binaries, config files, and anything stored under ProgramData.

This change makes the uninstall process safer and more predictable by default, while still giving users full control to clean up everything if desired.

TODOs not included in this PR

The help messages are almost the same for all the tools. To make it easier to update the help messages, use Comment-based help. Update docs to use inline function documentation #56

Testing information

  • To install the binaries only:

    Uninstall-Containerd
  • To uninstall all tool related data:

    Uninstall-Containerd -Purge

Checklist

As part of our commitment to engineering excellence, before submitting this PR, please make sure:

  • You've tested this code in both Desktop & Server environments and AMD & ARM64 enviroments (functional testing).
  • You've added unit tests for new code.
  • You've added/updated documentation in the cmdlet docs, command-reference.md and the modules help files.
  • You've reviewed the PR/code best practices defined in the CONTRIBUTING.md.

In addition, after this PR has been reviewed, please agree to:

  • If changes have been made to your PR in the process of addressing comments, please make sure to test again the final version in both AMD and ARM64 environments.
  • Validate your changes have not introduced any regressions.

@TinaMor TinaMor marked this pull request as ready for review April 23, 2025 12:41
@TinaMor TinaMor requested a review from iankingori as a code owner April 23, 2025 12:41
@TinaMor TinaMor marked this pull request as draft April 23, 2025 12:55
@TinaMor TinaMor force-pushed the fix-uninstall-#40 branch from da45c0b to d870f04 Compare April 30, 2025 11:33
    - Refactor uninstall to only remove program data files when the `-purge` flag is passsed
    - Add unit tests for the `-purge` functionality
    - Update documentation for -purge flag and other documentation issues
    - Minor bug fixes
@TinaMor TinaMor force-pushed the fix-uninstall-#40 branch from 70707a8 to e16fac4 Compare April 30, 2025 11:55
@TinaMor TinaMor marked this pull request as ready for review April 30, 2025 11:57
@TinaMor TinaMor requested a review from CharityKathure as a code owner April 30, 2025 11:57
@TinaMor TinaMor linked an issue May 19, 2025 that may be closed by this pull request
Copy link
Contributor

@CharityKathure CharityKathure left a comment

Choose a reason for hiding this comment

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

LGTM

@TinaMor TinaMor merged commit 216fb37 into main May 21, 2025
7 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.

BUG: Uninstall-Containerd too destructive
3 participants