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

['install_vars']['chocolateyVersion'] always installs newest version then tries to upgrade to specified version #152

Open
JoelMiller74 opened this issue Nov 6, 2022 · 0 comments

Comments

@JoelMiller74
Copy link

JoelMiller74 commented Nov 6, 2022

Cookbook version

3.0.0

Chef-client version

14.15.6

Platform Details

Windows 2016 Server

Scenario:

Pin versions of Chocolatey executable (in this case 1.1.0) using the ['install_vars']['chocolateyVersion'] attribute. When doing so, it appears that it always installs the newest available version from the repository (https://github.com/chocolatey-community/chocolatey-cookbook/blob/master/recipes/default.rb#L36-L41)

Steps to Reproduce:

Call Chocolatey Recipe
Set ['install_vars']['chocolateyVersion'] to 1.1.0 even though the repository contains a newer version such as 1.20
In my case, the following attributes were set:
default['chocolatey']['install_vars']['chocolateyVersion'] = '1.1.0'
default['chocolatey']['install_vars']['chocolateyDownloadUrl'] = "https://artifactory.infinitecampus.com/artifactory/chocolatey-production-virtual/choco/chocolatey.#{node['chocolatey']['install_vars']['chocolateyVersion']}.nupkg"
default['chocolatey']['install_vars']['chocolateyUseWindowsCompression'] = 'true'
default['chocolatey']['sensitive'] = true
default['chocolatey']['upgrade'] = true

Expected Result:

Version 1.1.0 will be installed and not upgraded

Actual Result:

Version 1.2.0 is installed and then it tries to upgrade to the version I specified (1.1.0) which fails

Install Details

I am using Chef to install Chocolatey for Business. We use Artifactory Enterprise Plus to host internalized packages and the Chocolatey package.

It appears that the Supermarket cookbook installs the newest version only (1.2.0) and disregards the version specified in the attributes (['install_vars']['chocolateyVersion']) - chocolatey-cookbook/default.rb at master · chocolatey-community/chocolatey-cookbook (github.com).

Then on a second pass, it uses chocolatey_package :upgrade action to upgrade to the version I specified (1.1.0) which causes a failure. - chocolatey-cookbook/default.rb at master · chocolatey-community/chocolatey-cookbook (github.com)

Also, the attribute ['install_vars']['chocolateyDownloadUrl'] has a default of https://chocolatey.org/api/v2/package/chocolatey. This is the community repository and not a direct link to specific nuget package in the repository. I am overriding this to point to our Artifactory repository. However, it is failing to find the package unless I give it the absolute URL with the versioned nuget path. I am wondering if there is a way to supply the path to the repository only and let the version I request automatically be found. I do not see an example of how to specify something like an Artifactory URL.

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

No branches or pull requests

1 participant