Skip to content

Harden Remove-OldPSNowManifest: validate source template exists before deleting existing manifest #50

Description

@johnmccrae

Problem

Remove-OldPSNowManifest deletes the existing PlasterManifest.xml before checking whether the replacement source file ("$BaseManifest.xml") exists. If the source is missing, Copy-Item throws a generic error after the original manifest is already gone, leaving the template root in a broken state.

Files

  • Private/Remove-OldPSNowManifest.ps1 (lines 14–27)

Acceptance Criteria

  • Function throws a clear, terminating ErrorRecord if "$BaseManifest.xml" does not exist in PlasterTemplate/
  • The throw happens before any Remove-Item calls — existing manifest is never deleted if replacement is missing
  • New Pester tests cover the missing-template path and verify no Remove-Item is called
  • Existing tests remain green

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions