Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-283) Fix deprecation error
Browse files Browse the repository at this point in the history
In situations where the resource described in the manifest includes a
version in its ensure property and choco v1 or above is installed,
puppet runs would fail. This was happening of an issue where the
version of chocolatey was not being properly derived by choco_version.

In turn, would cause compiled_choco to return false causing the
module to default to using choco update rather than choco upgrade.

This commit fixes that by ensuring that the choco_version method
returns the correct puppet version.
chelnak committed Apr 7, 2022
1 parent f684509 commit a9c3ab1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/puppet_x/chocolatey/chocolatey_common.rb
Original file line number Diff line number Diff line change
@@ -61,7 +61,9 @@ def set_env_chocolateyinstall
#
# @return [String] Semver string of Chocolatey version
def choco_version
@chocoversion ||= strip_beta_from_version(Facter.value('chocolateyversion') || PuppetX::Chocolatey::ChocolateyVersion.version)
version_fact = Facter.value('chocolateyversion') == '0' ? nil : Facter.value('chocolateyversion')
@chocoversion ||= strip_beta_from_version(version_fact || PuppetX::Chocolatey::ChocolateyVersion.version)
@chocoversion
end
module_function :choco_version

0 comments on commit a9c3ab1

Please sign in to comment.