mixlib-install 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c49c14b6182e48d0e62bdddc9677cc8c368eb30
4
- data.tar.gz: 36429f8f5161f5ed5ea3a75aaeafc6ebdf43c3d1
3
+ metadata.gz: da86da1678b6aef5defbe82060f7476caa1f62e7
4
+ data.tar.gz: fad6d57bd932742b690beaed6d1dba6f5f2061eb
5
5
  SHA512:
6
- metadata.gz: 5560590bf8b7e98ac892073bb8f89ff18d31b0ad285c153d8257c5295d1926e6525e6bc40554886e8a5340c6e02a88be76b5323ecc4d963dce7021818a29bd28
7
- data.tar.gz: 93358f525f3b45e3ef426b0312e61f2151886a6d6c80fff2ee8a37524769ed118ba68fd59b536c861be302154f4e6b4f8ddf1be023681406421b7ff1631d6a83
6
+ metadata.gz: bdf236b22604381394f24df9d0182eb2881ffc6964e2879ab5c3d20c8b21a494ec8cc2b1eb38460fc762cd0bf449986ce6c68ed1fd847b75caa70326834ac983
7
+ data.tar.gz: 4d5d547af2ad2429a35a327cb3f8680277c43973ce0dded009767780c128dc5a47e8e0e8b32582be9dfe2aca98e2fdfa22110b78cda24a21d4c946f6cce51ac0
@@ -0,0 +1,26 @@
1
+ # Change Log
2
+ This change log follows the principles
3
+ outlined from [Keep a CHANGELOG](http://keepachangelog.com/).
4
+
5
+ All notable changes to this project will be documented in this file.
6
+ This project adheres to [Semantic Versioning](http://semver.org/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.0.1] - 2016-03-31
11
+ ### Fixed
12
+ - detect_platform method for Windows
13
+
14
+ ### Changed
15
+ - added stopaction to kick in the catch statement if manifest is missing
16
+ - wait for msiexec to exit
17
+ - Replace md5sum checks with sha256 checks in install_command.ps1
18
+
19
+ ## [1.0.0] - 2016-03-30
20
+ ### Added
21
+ - Ability to query product artifacts from multiple channels
22
+ - Ability to generate installation scripts for `sh` and `ps1`
23
+
24
+ [Unreleased]: https://github.com/chef/mixlib-install/compare/v1.0.1...HEAD
25
+ [1.0.1]: https://github.com/chef/mixlib-install/compare/v1.0.0...v1.0.1
26
+ [1.0.0]: https://github.com/chef/mixlib-install/compare/v0.7.1...v1.0.0
@@ -116,14 +116,21 @@ module Mixlib
116
116
  # Returns a Hash containing the platform info options
117
117
  #
118
118
  def self.detect_platform
119
- detect_command = if Gem.win_platform?
120
- Mixlib::ShellOut.new(self.detect_platform_ps1)
121
- else
122
- Mixlib::ShellOut.new(self.detect_platform_sh)
123
- end
124
-
125
- detect_command.run_command
126
- platform_info = detect_command.stdout.split
119
+ output = if Gem.win_platform?
120
+ # For Windows we write the detect platform script and execute the
121
+ # powershell.exe program with Mixlib::ShellOut
122
+ Dir.mktmpdir do |d|
123
+ File.open(File.join(d, "detect_platform.ps1"), "w+") do |f|
124
+ f.puts self.detect_platform_ps1
125
+ end
126
+
127
+ Mixlib::ShellOut.new("powershell.exe -file #{File.join(d, "detect_platform.ps1")}").run_command
128
+ end
129
+ else
130
+ Mixlib::ShellOut.new(self.detect_platform_sh).run_command
131
+ end
132
+
133
+ platform_info = output.stdout.split
127
134
 
128
135
  {
129
136
  platform: platform_info[0],
@@ -60,18 +60,9 @@ function Test-ProjectPackage {
60
60
  function Get-FileHash ($Path, $Algorithm) {
61
61
  $Path = (resolve-path $path).providerpath
62
62
  $hash = @{Algorithm = $Algorithm; Path = $Path}
63
- if ($Algorithm -like 'MD5') {
64
- use ($c = New-Object -TypeName Security.Cryptography.MD5CryptoServiceProvider) {
65
- use ($in = (gi $path).OpenRead()) {
66
- $hash.Hash = ([BitConverter]::ToString($c.ComputeHash($in))).Replace("-", "").ToUpper()
67
- }
68
- }
69
- }
70
- elseif ($Algorithm -like 'SHA256') {
71
- use ($c = New-Object -TypeName Security.Cryptography.SHA256CryptoServiceProvider) {
72
- use ($in = (gi $path).OpenRead()) {
73
- $hash.Hash = ([BitConverter]::ToString($c.ComputeHash($in))).Replace("-", "").ToUpper()
74
- }
63
+ use ($c = New-Object -TypeName Security.Cryptography.SHA256CryptoServiceProvider) {
64
+ use ($in = (gi $path).OpenRead()) {
65
+ $hash.Hash = ([BitConverter]::ToString($c.ComputeHash($in))).Replace("-", "").ToUpper()
75
66
  }
76
67
  }
77
68
  new-object PSObject -Property $hash
@@ -86,6 +86,7 @@ function Install-Project {
86
86
  if (Test-ProjectPackage -Path $download_destination -Algorithm 'SHA256' -Hash $package_metadata.sha256) {
87
87
  Write-Host "Installing $project from $download_destination"
88
88
  $p = Start-Process -FilePath "msiexec" -ArgumentList "/qn /i $download_destination" -Passthru -Wait
89
+ $p.WaitForExit()
89
90
  if ($p.ExitCode -ne 0) {
90
91
  throw "msiexec was not successful. Received exit code $($p.ExitCode)"
91
92
  }
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@ Function Check-UpdateChef($root, $version) {
3
3
  elseif ("$version" -eq "true") { return $false }
4
4
  elseif ("$version" -eq "latest") { return $true }
5
5
 
6
- Try { $chef_version = (Get-Content $root\version-manifest.txt | select-object -first 1) }
6
+ Try { $chef_version = (Get-Content $root\version-manifest.txt -ErrorAction stop | select-object -first 1) }
7
7
  Catch {
8
8
  Try { $chef_version = (& $root\bin\chef-solo.bat -v) }
9
9
  Catch { $chef_version = " " }
@@ -18,32 +18,33 @@ Function Get-ChefMetadata($url) {
18
18
  Finally { if ($c -ne $null) { $c.Dispose() } }
19
19
 
20
20
  $md = ConvertFrom-StringData $response.Replace("`t", "=")
21
- return @($md.url, $md.md5)
21
+ return @($md.url, $md.sha256)
22
22
  }
23
23
 
24
- Function Get-MD5Sum($src) {
24
+ Function Get-SHA256($src) {
25
25
  Try {
26
- $c = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
26
+ $c = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider
27
27
  $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
28
28
  return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
29
29
  } Finally { if (($c -ne $null) -and ($c.GetType().GetMethod("Dispose") -ne $null)) { $c.Dispose() }; if ($in -ne $null) { $in.Dispose() } }
30
30
  }
31
31
 
32
- Function Download-Chef($url, $md5, $dst) {
32
+ Function Download-Chef($url, $sha256, $dst) {
33
33
  Try {
34
34
  Log "Downloading package from $url"
35
35
  ($c = Make-WebClient).DownloadFile($url, $dst)
36
36
  Log "Download complete."
37
37
  } Finally { if ($c -ne $null) { $c.Dispose() } }
38
38
 
39
- if ($md5 -eq $null) { Log "Skipping md5 verification" }
40
- elseif (($dmd5 = Get-MD5Sum $dst) -eq $md5) { Log "Successfully verified $dst" }
41
- else { throw "MD5 for $dst $dmd5 does not match $md5" }
39
+ if ($sha256 -eq $null) { Log "Skipping sha256 verification" }
40
+ elseif (($dsha256 = Get-SHA256 $dst) -eq $sha256) { Log "Successfully verified $dst" }
41
+ else { throw "SHA256 for $dst $dsha256 does not match $sha256" }
42
42
  }
43
43
 
44
44
  Function Install-Chef($msi) {
45
45
  Log "Installing Chef Omnibus package $msi"
46
46
  $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait
47
+ $p.WaitForExit()
47
48
 
48
49
  if ($p.ExitCode -ne 0) { throw "msiexec was not successful. Received exit code $($p.ExitCode)" }
49
50
 
@@ -72,12 +73,12 @@ $msi = Unresolve-Path $msi
72
73
  if (Check-UpdateChef $chef_omnibus_root $version) {
73
74
  Write-Host "-----> Installing Chef Omnibus ($pretty_version)`n"
74
75
  if ($chef_metadata_url -ne $null) {
75
- $url, $md5 = Get-ChefMetadata "$chef_metadata_url"
76
+ $url, $sha256 = Get-ChefMetadata "$chef_metadata_url"
76
77
  } else {
77
78
  $url = $chef_msi_url
78
- $md5 = $null
79
+ $sha256 = $null
79
80
  }
80
- Download-Chef "$url" $md5 $msi
81
+ Download-Chef "$url" $sha256 $msi
81
82
  Install-Chef $msi
82
83
  } else {
83
84
  Write-Host "-----> Chef Omnibus installation detected ($pretty_version)`n"
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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-30 00:00:00.000000000 Z
12
+ date: 2016-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: artifactory
@@ -135,6 +135,7 @@ files:
135
135
  - ".rspec"
136
136
  - ".rubocop.yml"
137
137
  - ".travis.yml"
138
+ - CHANGELOG.md
138
139
  - CONTRIBUTING.md
139
140
  - Gemfile
140
141
  - LICENSE