Skip to content

Conversation

@johnmccrae
Copy link
Contributor

@johnmccrae johnmccrae commented Apr 4, 2024

Description

Choco has 2 clients: Open Source and Licensed. The existing code worked great for open source customers. It fails for licensed customers. To be a 'licensed' customer you need the choco client, a license file and a package called the Chocolatey.Extension. Customers would attempt to use the chocolatey_package resource to install the extension but since the existing code used "choco --version" to get some details, the package would fail with a license warning. It's a chicken-egg issue. We need the package installed to make the warning go away and we can't get it installed unless we know which version of choco we're using. The workaround is the code below which queries the exe directly without actually invoking it. Customer Bug

Here is a comparison output from both methods:

❯ choco --version
2.2.2

❯ Get-ItemProperty "${env:ChocolateyInstall}/choco.exe" | select-object -expandproperty versioninfo| select-object -expandproperty productversion
2.2.2

Related Issue

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)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
@johnmccrae johnmccrae requested review from a team as code owners April 4, 2024 22:09
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 8, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@johnmccrae johnmccrae merged commit 99ab76f into main Apr 8, 2024
@johnmccrae johnmccrae deleted the jfm/chef18-choco-version-check-bug branch April 8, 2024 17:43
femiagbabiaka pushed a commit to femiagbabiaka/chef that referenced this pull request Dec 3, 2024
* Refactoring the choco version check
Signed-off-by: John McCrae <john.mccrae@progress.com>
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.

3 participants