Chef Infra, a powerful automation platform that transforms infrastructure into code automating how infrastructure is configured, deployed and managed across any environment, at any scale
When specifying a version for a chocolatey package, you can only roll forward, not back, because the invocation to choco.exe lacks the --allow-downgrade or --force flag. It should probably either set --allow-downgrade every time or the provider should support allow_downgrade as an option (like, e.g., the yum package provider).
Chef Version
This is true on master (and reading code, probably since the provider was introduced)
Platform Version
Windows 10 1803 (but should repeat on any Windows install)
Replication Case
Install a newer version of a package outside of chef
Attempt to run chef-client
error (pasted below)
Client Output
The package name has been changed for illustrative purposes.
Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
- some-windows-package - A newer version of some-windows-package (v20210812.092429) is already installed.
Use --allow-downgrade or --force to attempt to install older versions, or use side by side to allow multiple versions.
STDERR:
---- End output of ["C:\\ProgramData\\chocolatey/bin/choco.exe", "install", "-y", "--version", "20210810.135405", "some-windows-package"] ----
Ran ["C:\\ProgramData\\chocolatey/bin/choco.exe", "install", "-y", "--version", "20210810.135405", "some-windows-package"] returned 1
[2021-08-12 18:42:11 +0100] INFO chefctl.rb: chef-client.bat failed with exit code 1, check log output!
Reading code again this morning I realized that I can pass in arbitrary options to choco.exe using the options field, so I did that for now, but that's more of a workaround than a fix.
Description
When specifying a version for a chocolatey package, you can only roll forward, not back, because the invocation to
choco.exe
lacks the--allow-downgrade
or--force
flag. It should probably either set--allow-downgrade
every time or the provider should supportallow_downgrade
as an option (like, e.g., the yum package provider).Chef Version
This is true on master (and reading code, probably since the provider was introduced)
Platform Version
Windows 10 1803 (but should repeat on any Windows install)
Replication Case
chef-client
Client Output
The package name has been changed for illustrative purposes.
Stacktrace
N/A