Warn when -Cleanup is skipped because installation was skipped (AWS.Tools.Installer 2.0.4) - #434
Open
jnunn-aws wants to merge 1 commit into
Open
Warn when -Cleanup is skipped because installation was skipped (AWS.Tools.Installer 2.0.4)#434jnunn-aws wants to merge 1 commit into
jnunn-aws wants to merge 1 commit into
Conversation
Install-AWSToolsModule and Install-AWSToolsInstaller skip installation when the requested version is already installed, then return before their cleanup step. As a result a requested -Cleanup was silently a no-op, leaving customers believing cleanup ran (older versions remained on disk). Rather than derive a cleanup keep-set from on-disk state (which would bake in the unified-versioning assumption and break under future mixed per-module versioning), keep the skip and emit a warning: cleanup was skipped because installation was skipped, and -Force is required to reinstall and clean up other versions. Cleanup stays authoritative because it only runs as part of an actual install (keep-set = what was installed from the archive). - Install-AWSToolsModule: warn in both the install-all and named-subset skip paths when -Cleanup is set. - Install-AWSToolsInstaller: warn in its already-installed skip path when -Cleanup is set. - Document the behavior on the -Cleanup parameter of Install-AWSToolsModule, Update-AWSToolsModule, and Install-AWSToolsInstaller (in-line help and the static WebHelp pages). - Bump AWS.Tools.Installer module version 2.0.3 -> 2.0.4. Adds unit tests: warn + skip cleanup on skip (install-all, named, and the installer), and no spurious warning when -Cleanup is not specified.
jnunn-aws
requested review from
afroz429 and
sankettangade
and removed request for
a team
August 18, 2026 17:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the requested version is already installed,
Install-AWSToolsModuleandInstall-AWSToolsInstallerskip the install and return before their cleanup step. As a result, a requested-Cleanupwas silently a no-op — older versions were left on disk while the command appeared to succeed.This change keeps the skip but announces it: when
-Cleanupis specified and installation is skipped, a warning is emitted stating that cleanup was skipped and that-Forceis required to reinstall and clean up other versions.Changes:
Install-AWSToolsModule— warn in both the install-all and named-subset skip paths when-Cleanupis set.Install-AWSToolsInstaller— warn in its already-installed skip path when-Cleanupis set.-Cleanupparameter ofInstall-AWSToolsModule,Update-AWSToolsModule, andInstall-AWSToolsInstaller(in-line comment-based help and the static WebHelp pages underWebHelp/InstallerContent/items/).AWS.Tools.Installermodule version2.0.3->2.0.4.The fix keeps cleanup tied to an actual installation: the set of modules to preserve is exactly what was installed from the archive, rather than inferred from local disk state (which can be inaccurate).
Motivation and Context
A customer ran an install without
-Cleanup, then immediately re-ran with-Cleanup, and the folder module versions were not removed. Root cause: install was skipped (target already present), and the skip returned before the cleanup step, so-Cleanupnever ran — with no indication to the user. The fix makes the skipped cleanup visible and tells the user how to force it.Testing
buildtools/installer.README.md(buildtools/Build-AWSToolsInstaller.ps1), which compilesAWS.Tools.Installer.Liband stages toDeployment/AWS.Tools/AWS.Tools.Installer/(confirmed staged version2.0.4).-Cleanupis not specified.Dry-run
Breaking Changes Assessment
No breaking changes.
Types of changes
Checklist
We require a second engineer to validate the PR before merging
New/existing dependencies impact assessment, if applicable
No new or modified dependencies.
License