forked from chocolatey-archive/puppet-chocolatey
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(MODULES-6652) Make 7zip DL source configurable
Prior to this commit the 7zip executable, a requirement for the installation of Chocolatey, was hardcoded for download from a single internet URL. This caused failures when pointed through a proxy. This commit adds a new parameter, `$seven_zip_download_url` to the Chocolatey class. This is used to specify the path to the `7za.exe` binary, which can live anywhere that the Puppet File resource can retrieve it for the target machine. It uses such a file declaration in the `install.pp` manifest to handle cases where the use of 7zip is required. This parameter defaults to the previously hardcoded URL, `https://chocolatey.org/7za.exe`. This commit also adds a new fact, `choco_temp_dir`, to discover the appropriate temporary folder on disk in which to place the 7zip binary. It follows the pattern for using/testing facts as the `choco_install_path` fact already used in this module, by adding the logic for the fact in helper code. This commit therefore also includes new tests to the module for the helper code, the fact, the parameter, and the expected change in behavior. It also includes updated documentation per the new parameter.
- Loading branch information
1 parent
c875d20
commit 7e6db24
Showing
11 changed files
with
139 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'pathname' | ||
require Pathname.new(__FILE__).dirname + '../' + 'puppet_x/chocolatey/chocolatey_install' | ||
|
||
Facter.add('choco_temp_dir') do | ||
confine :osfamily => :windows | ||
setcode do | ||
PuppetX::Chocolatey::ChocolateyInstall.temp_dir || ENV['TEMP'] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require 'spec_helper' | ||
require 'facter' | ||
require 'puppet_x/chocolatey/chocolatey_install' | ||
|
||
describe 'choco_temp_dir fact' do | ||
subject(:fact) { Facter.fact(:choco_temp_dir) } | ||
|
||
before :each do | ||
Facter.clear | ||
Facter.clear_messages | ||
end | ||
|
||
context "on Windows", :if => Puppet::Util::Platform.windows? do | ||
it "should return the TEMP directory" do | ||
expected_value = 'waffles' | ||
PuppetX::Chocolatey::ChocolateyInstall.expects(:temp_dir).returns(expected_value) | ||
|
||
subject.value.must == expected_value | ||
end | ||
it "should return the default path when PuppetX::Chocolatey::ChocolateyInstall.install_path is nil" do | ||
PuppetX::Chocolatey::ChocolateyInstall.expects(:temp_dir).returns(nil) | ||
|
||
subject.value.must == ENV['TEMP'] | ||
end | ||
end | ||
|
||
after :each do | ||
Facter.clear | ||
Facter.clear_messages | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters