Skip to content

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
developmentfrom
installer-v2/cleanup-on-skip
Open

Warn when -Cleanup is skipped because installation was skipped (AWS.Tools.Installer 2.0.4)#434
jnunn-aws wants to merge 1 commit into
developmentfrom
installer-v2/cleanup-on-skip

Conversation

@jnunn-aws

@jnunn-aws jnunn-aws commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

When the requested version is already installed, Install-AWSToolsModule and Install-AWSToolsInstaller skip the install and return before their cleanup step. As a result, a requested -Cleanup was 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 -Cleanup is specified and installation is skipped, a warning is emitted stating that cleanup was skipped and that -Force is required to reinstall and clean up other versions.

Changes:

  • 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.
  • Documented the behavior on the -Cleanup parameter of Install-AWSToolsModule, Update-AWSToolsModule, and Install-AWSToolsInstaller (in-line comment-based help and the static WebHelp pages under WebHelp/InstallerContent/items/).
  • Bumped AWS.Tools.Installer module version 2.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 -Cleanup never ran — with no indication to the user. The fix makes the skipped cleanup visible and tells the user how to force it.

Testing

  • Built and staged the module per buildtools/installer.README.md (buildtools/Build-AWSToolsInstaller.ps1), which compiles AWS.Tools.Installer.Lib and stages to Deployment/AWS.Tools/AWS.Tools.Installer/ (confirmed staged version 2.0.4).
  • Ran the full Installer Pester unit suite: 461 passed, 0 failed, 1 skipped, 5 not-run (skipped/not-run are Windows-only, platform-gated).
  • Added unit tests: warn + skip cleanup on the skip path for install-all, named-subset, and the installer cmdlet; and a guard that no warning is emitted when -Cleanup is not specified.

Dry-run

  • Dry-run ID: d465eb49-876f-4fc6-b6db-43d98af94448
  • Status:
    • Pending
    • Completed successfully
    • Failed
  • Failed bypass reason: N/A

Breaking Changes Assessment

No breaking changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

We require a second engineer to validate the PR before merging

  • My code builds in Gamma and passes backward compatibility validation (required)
  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

New/existing dependencies impact assessment, if applicable

No new or modified dependencies.

License

  • I confirm that this pull request can be released under the Apache 2 license

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
jnunn-aws requested review from a team as code owners August 18, 2026 17:25
@jnunn-aws
jnunn-aws requested review from afroz429 and sankettangade and removed request for a team August 18, 2026 17:25
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