-
Notifications
You must be signed in to change notification settings - Fork 70
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
(MODULES-6652) Fix download 7z behind proxy #94
Conversation
387e394
to
9aeda4e
Compare
6c414ed
to
50f1b38
Compare
A few things:
|
We are pushing the latest 7za up to https://chocolatey.org, so if you want to use that as a source, hold until we have it up there. |
Do you have something specific in mind here? I did not use a temp location on purpose to avoid recreating
Should be the case already since I used the one from chocolatey.org
I could only find 18.0.1; so I'll just wait until you tell me to redownload. |
50f1b38
to
2c23510
Compare
@helge000 https://chocolatey.org/7za.exe is now 18.1. (it shows 18.0.1 as product version). |
manifests/install.pp
Outdated
$unzip_type = $::chocolatey::use_7zip ? { | ||
true => '7zip', | ||
default => 'windows' | ||
$sevenzip_exe = "${::system32}\\chocolatey_temp_7za.exe" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't mind code style, we could use something like
$sevenzip_exe = inline_template('"#{ENV['TEMP']}\\7za.exe"')
Witch is basically the current behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could work, but I wonder what the Puppet style guide says about that.
I am not OK with vendoring in a binary in our module, or writing it to system32 |
@jpogran I replied at https://tickets.puppetlabs.com/browse/MODULES-6652. Let me know if you want to keep the discussion here or if that location is more appropriate? |
I can understand the appeal of vendoring
Given the above complexity, is there another way we could address the hardcoded URI? For instance, would it be enough to make it configurable, so that users can stage their own copy (for instance by placing it in a Code Manager control repo), and using a |
9491105
to
de1d97f
Compare
@Iristyle, thanks for elaborating; makes much more sense to me now. |
manifests/init.pp
Outdated
@@ -62,6 +66,7 @@ | |||
class chocolatey ( | |||
$choco_install_location = $::chocolatey::params::install_location, | |||
$use_7zip = $::chocolatey::params::use_7zip, | |||
$binary_7zip = $::chocolatey::params::binary_7zip, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferventcoder, are you ok with this new param name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't self document what it is. Needs something like 7zip_download_url
to make it consistent with the other params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly, though I cannot start a var name with a number. What about:
$download_url_7zip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch. How about seven_zip_download_url
? Although both would probably work, just weird workaround that folks may not immediately understand.
@ferventcoder, I refactored to use a new parameter. I also tried to find the relevant docs. I feel I should also add a spec for the new file? |
@Iristyle way ahead of you on that (see JIRA) - but thank you for elaborating on the reasoning. |
de1d97f
to
823f103
Compare
823f103
to
d3f89d4
Compare
d3f89d4
to
ee8806f
Compare
@@ -793,6 +793,10 @@ If you override the default installation directory you need to set appropriate p | |||
|
|||
Specifies whether to use the built-in shell or allow the installer to download 7zip to extract `chocolatey.nupkg` during installation. Valid options: `true`, `false`. Default: `false`. | |||
|
|||
##### `seven_zip_download_url` | |||
|
|||
Specifies the source file for `7za.exe`. Supports all sources supported by Puppet's `file {}` resource. You should use a 32bit binary for compatibility. Defaults to `https://chocolatey.org/7za.exe` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: perhaps instead of file {}
use [file](<url to file resource>)
ee8806f
to
8f1584f
Compare
c37317e
to
d6db7cd
Compare
0041283
to
7e6db24
Compare
spec/unit/facter/choco_temp_dir.rb
Outdated
Facter.clear_messages | ||
end | ||
|
||
context "on Windows", :if => Puppet::Util::Platform.windows? do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should maybe replace with skips in the It blocks? CC @ThoughtCrhyme
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.
7e6db24
to
f50315d
Compare
Adds a local file '7za.exe' witch is copied to $::system32 in case unzip
method is '7zip'.
7za - source: https://chocolatey.org/7za.exe, witch was originally used
in the template.