Skip to content

Commit

Permalink
Merge pull request #286 from puppetlabs/GH-283-choco_update_is_deprec…
Browse files Browse the repository at this point in the history
…ated

(GH-283) Fix deprecation error
  • Loading branch information
david22swan authored Apr 8, 2022
2 parents f684509 + 1a83f70 commit 5ce30f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/puppet_x/chocolatey/chocolatey_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
@chocoversion ||= strip_beta_from_version((version_fact == '0' ? nil : version_fact) || PuppetX::Chocolatey::ChocolateyVersion.version)
@chocoversion
end
module_function :choco_version

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/provider/package/chocolatey_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
it 'uses install command with held package' do
allow(provider.class).to receive(:compiled_choco?).and_return(true)
expect(Facter).to receive(:value).with('choco_install_path').and_return('c:\dude')
expect(Facter).to receive(:value).with('chocolateyversion').and_return(first_compiled_choco_version)
expect(Facter).to receive(:value).with('chocolateyversion').and_return(first_compiled_choco_version).twice
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with('c:\dude\bin\choco.exe').and_return(true)
# unhold is called in installs on compiled choco
allow(Puppet::Util::Execution).to receive(:execute)
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/puppet_x/chocolatey/chocolatey_common_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
let(:choco_install_loc) { 'c:\dude' }

before(:each) do
expect(Facter).to receive(:value).with('choco_install_path').and_return(choco_install_loc)
expected_version = '0.9.9.0.1'
expect(Facter).to receive(:value).with('choco_install_path').and_return(choco_install_loc).once
expect(Facter).to receive(:value).with('chocolateyversion').and_return(expected_version).once
end

it 'returns the normal config file location when found' do
Expand Down

0 comments on commit 5ce30f9

Please sign in to comment.