mixlib-install 2.1.8 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40fa6c0a0b63502b8c38218361ecff0c041ebbd7
4
- data.tar.gz: e151caa4b979c2e561c5520d860bfc4e0f544e9a
3
+ metadata.gz: 85494cb7677e35f2fd1a84ec8c23ecfc0d24efef
4
+ data.tar.gz: 38048f01eafc6bd86d79cab807957e0e62a98ab9
5
5
  SHA512:
6
- metadata.gz: 4441ee64cfed4d6cc63ccf209def59e4f3866393b389d9cbd70c3211a7332e1d4b664a1e21ed972b6062d3bf423ec16686c18efb92dee48803d8f3c05726efcb
7
- data.tar.gz: 8f7c097bd4c36ab4474dec1007d82da49b02d015be101575348cca832ed503e6063b5123ed3536c78cc9ac9779234859dd8283678d88841a8bfc67926649c7a3
6
+ metadata.gz: 489c05e749dd5b421d34b0366872dc9006d1cea865ab8e01b35126808b112341723e9cbb87588ce8b7d85c963d179e148a4049db59b905872e9ed2eeb4934f73
7
+ data.tar.gz: 89c412f80a84c223af0f329674affd1325ea9e2f846bf58df0f944c7429613d591d08923648e48b653b018c04f091d2c42d8fff1ef40eab39b17abae31cfa706
@@ -1,8 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## [2.1.9]
4
+ - Add `download_directory` option to powershell install script
5
+
3
6
  ## [2.1.8]
4
7
  - Query performance optimizations
5
- - Add ChefClientFeature support to the MSI install script
8
+ - Add ChefClientFeature support to the powershell install script
6
9
 
7
10
  ## [2.1.7]
8
11
  - Add support for passing arguments to the MSI in install scripts
@@ -130,9 +130,12 @@ module Mixlib
130
130
  # @return [String] shell variable lines
131
131
  # @api private
132
132
  def install_command_vars_for_powershell
133
+ d_flag = install_flags.nil? ? nil : install_flags.match(/-download_directory (\S+)/)
134
+ download_directory = d_flag.nil? ? "$env:TEMP" : d_flag[1]
133
135
  [
134
136
  shell_var("chef_omnibus_root", root),
135
- shell_var("msi", "$env:TEMP\\chef-#{version}.msi"),
137
+ shell_var("msi", "#{download_directory}\\chef-#{version}.msi"),
138
+ shell_var("download_directory", download_directory),
136
139
  ].tap do |vars|
137
140
  if install_msi_url
138
141
  vars << shell_var("chef_msi_url", install_msi_url)
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "2.1.8"
3
+ VERSION = "2.1.9"
4
4
  end
5
5
  end
@@ -43,8 +43,14 @@ Function Download-Chef($url, $sha256, $dst) {
43
43
  Log "Download complete."
44
44
 
45
45
  if ($sha256 -eq $null) { Log "Skipping sha256 verification" }
46
- elseif (($dsha256 = Get-SHA256 $dst) -eq $sha256) { Log "Successfully verified $dst" }
47
- else { throw "SHA256 for $dst $dsha256 does not match $sha256" }
46
+ elseif (Verify-SHA256 $dst $sha256) { Log "Successfully verified $dst" }
47
+ else { throw "SHA256 for $dst does not match $sha256" }
48
+ }
49
+
50
+ Function Verify-SHA256($path, $sha256) {
51
+ if ($sha256 -eq $null) { return $false }
52
+ elseif (($dsha256 = Get-SHA256 $path) -eq $sha256) { return $true }
53
+ else { return $false }
48
54
  }
49
55
 
50
56
  Function Install-Chef($msi, $chef_omnibus_root) {
@@ -63,7 +69,6 @@ Function Install-Chef($msi, $chef_omnibus_root) {
63
69
  if(!$result) { continue }
64
70
  $installingChef = $False
65
71
  }
66
- Remove-Item $msi -Force
67
72
  Log "Installation complete"
68
73
  }
69
74
 
@@ -185,9 +190,13 @@ if (Check-UpdateChef $chef_omnibus_root $version) {
185
190
  $url = $chef_msi_url
186
191
  $sha256 = $null
187
192
  }
188
- $msi = Join-Path $env:temp "$url".Split("/")[-1]
193
+ $msi = Join-Path $download_directory "$url".Split("/")[-1]
189
194
  $msi = Unresolve-Path $msi
190
- Download-Chef "$url" $sha256 $msi
195
+ if (Verify-SHA256 $msi $sha256) {
196
+ Log "Skipping package download; found a matching package at $msi"
197
+ } else {
198
+ Download-Chef "$url" $sha256 $msi
199
+ }
191
200
  Install-Chef $msi $chef_omnibus_root
192
201
  } else {
193
202
  Write-Host "-----> Chef Omnibus installation detected ($pretty_version)"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-install
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May