Skip to content
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

Add test-path handler to cChocoPackageInstall in case of missing ChocoInstalled.xml #177

Closed

Conversation

BCOps
Copy link

@BCOps BCOps commented Jun 12, 2023

Description Of Changes

cChocoPackageInstall Get-ChocoInstalledPackage has been updated to test for the presence of ChocoInstalled.xml before trying to delete it when purge is set to true, avoiding a breaking error if it is not located.

Motivation and Context

Fixes #160

Testing

  1. Validated on Windows Server 2019 by creating local cChoco DSC module at new version with applied changes. Resource specified was uninstalled and reinstalled at specific verison (as per report in issue DSC Compliance Failed: Cannot find path C:\\choco\\cache\\ChocoInstalled.xml\ because it does not exist. #160 ) with graceful handling of the missing ChocoInstalled.xml file. File was not detected, remove-item was skipped, and module run completed successfully.

Operating Systems Testing

  • Windows Server 2019 Core
  • Windows Server 2016

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

Fixes #160

@BCOps
Copy link
Author

BCOps commented Jun 12, 2023

Appveyor tests are showing as passing

Copy link
Member

@corbob corbob left a comment

Choose a reason for hiding this comment

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

In general this code looks good. I would like to potentially see the commits updated to follow the Chocolatey guidelines, but we don't currently have anything on this repository to indicate the style and such, so for now I'll leave that.

I would however prefer to see some pester tests that test this issue if possible. However, it would be good to look at Pester 5 tests as #163 is adding that support. If you wanted to take a look at adding some after that is merged it'd be appreciated.

@corbob corbob self-assigned this Jul 6, 2023
@corbob
Copy link
Member

corbob commented Jul 6, 2023

I just had a bit of a perusal over #103. If I understand this PR correctly, I suspect it took inspiration from that PR? Instead of the Invoke-Chocolatey and Invoke-ChocolateyProcess, we might want to consider using Invoke-Choco from the Chocolatey Pester tests here. Although maybe not returning or logging as much as there as it's not likely needed in the DSC context.

@AF250329
Copy link

Is there any news about this Pull Request ? Is it gonna be merged ?

@pauby
Copy link
Member

pauby commented Feb 13, 2024

@AF250329 This PR is waiting on a response to the last comment by @corbob.

@BCOps BCOps closed this Feb 13, 2024
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.

DSC Compliance Failed: Cannot find path C:\\choco\\cache\\ChocoInstalled.xml\ because it does not exist.
4 participants