mixlib-install 2.1.6 → 2.1.7

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.
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## [2.1.7]
4
+ - Add support for passing arguments to the MSI in install scripts
5
+ - Add platform version compatibility support for Windows (including desktop versions)
6
+ - Enable platform version compatibility option by default for the cli
7
+
3
8
  ## [2.1.6]
4
9
  - Add `User-Agent` headers to all download requests
5
10
  - CLI UX improvements
@@ -3,7 +3,7 @@
3
3
  set -evx
4
4
 
5
5
  # Don't run acceptance tests on forks. The decryption keys are not available.
6
- if [ "${TRAVIS_REPO_SLUG}" = "chef/mixlib-install" ]; then
6
+ if [ "${CHEF_ACCEPTANCE}" = "true" ] && [[ $encrypted_e2edbb28e76c_key ]]; then
7
7
 
8
8
  # download terraform
9
9
  wget "https://releases.hashicorp.com/terraform/0.7.4/terraform_0.7.4_linux_amd64.zip"
@@ -3,7 +3,7 @@
3
3
  set -evx
4
4
 
5
5
  # Don't run acceptance tests on forks. The decryption keys are not available.
6
- if [ "${CHEF_ACCEPTANCE}" = "true" ] && [ "${TRAVIS_REPO_SLUG}" = "chef/mixlib-install" ]; then
6
+ if [ "${CHEF_ACCEPTANCE}" = "true" ] && [[ $encrypted_e2edbb28e76c_key ]]; then
7
7
  # setup acceptance tests
8
8
  cd acceptance
9
9
  export BUNDLE_GEMFILE=$PWD/Gemfile
@@ -94,18 +94,19 @@ module Mixlib
94
94
  artifacts.each do |a|
95
95
  return a if a.platform_version == options.platform_version
96
96
 
97
- # We skip the artifacts produced for windows since their platform
98
- # version is always set to 2008r2 which breaks our `to_f` comparison.
99
- next if a.platform == "windows"
100
-
101
97
  # Calculate the closest compatible version.
102
98
  # For an artifact to be compatible it needs to be smaller than the
103
99
  # platform_version specified in options.
104
100
  # To find the closest compatible one we keep a max of the compatible
105
101
  # artifacts.
102
+
103
+ # Remove "r2" from artifacts produced for windows since platform
104
+ # versions with that ending break `to_f` comparisons.
105
+ current_platform_version = a.platform_version.chomp("r2").to_f
106
+
106
107
  if closest_compatible_artifact.nil? ||
107
- (a.platform_version.to_f > closest_compatible_artifact.platform_version.to_f &&
108
- a.platform_version.to_f < options.platform_version.to_f )
108
+ (current_platform_version > closest_compatible_artifact.platform_version.to_f &&
109
+ current_platform_version < options.platform_version.to_f )
109
110
  closest_compatible_artifact = a
110
111
  end
111
112
  end
@@ -36,6 +36,12 @@ module Mixlib
36
36
  default: "x86_64",
37
37
  aliases: ["-a"],
38
38
  enum: Mixlib::Install::Options::SUPPORTED_ARCHITECTURES.map(&:to_s)
39
+ option :platform_version_compat,
40
+ desc: "Enable or disable platform version compatibility mode.
41
+ This will match the closest earlier version if the passed version is unavailable.
42
+ If no earlier version is found the earliest version available will be set.",
43
+ type: :boolean,
44
+ default: true
39
45
  option :url,
40
46
  desc: "Print download URL without downloading the file",
41
47
  type: :boolean
@@ -48,6 +54,7 @@ module Mixlib
48
54
  channel: options[:channel].to_sym,
49
55
  product_name: product_name,
50
56
  product_version: options[:version],
57
+ platform_version_compatibility_mode: options[:platform_version_compat],
51
58
  }
52
59
 
53
60
  # Set platform info or auto detect platform
@@ -59,6 +66,7 @@ module Mixlib
59
66
  mixlib_install_options[:platform_version] = options[:platform_version]
60
67
  mixlib_install_options[:architecture] = options[:architecture]
61
68
  else
69
+
62
70
  mixlib_install_options.merge!(Mixlib::Install.detect_platform)
63
71
  end
64
72
 
@@ -42,7 +42,10 @@ function Install-Project {
42
42
  $nightlies,
43
43
  [validateset('auto', 'i386', 'x86_64')]
44
44
  [string]
45
- $architecture = 'auto'
45
+ $architecture = 'auto',
46
+ [validateset('auto', 'service', 'task')]
47
+ [string]
48
+ $daemon = 'auto'
46
49
  )
47
50
 
48
51
  $package_metadata = Get-ProjectMetadata -project $project -channel $channel -version $version -prerelease:$prerelease -nightlies:$nightlies -architecture $architecture
@@ -89,7 +92,7 @@ function Install-Project {
89
92
  $result = Install-ChefAppx $download_destination $project
90
93
  }
91
94
  else {
92
- $result = Install-ChefMsi $download_destination
95
+ $result = Install-ChefMsi $download_destination $daemon
93
96
  }
94
97
  if(!$result) { continue }
95
98
  $installingProject = $False
@@ -102,8 +105,17 @@ function Install-Project {
102
105
  }
103
106
  set-alias install -value Install-Project
104
107
 
105
- Function Install-ChefMsi($msi) {
106
- $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait
108
+ Function Install-ChefMsi($msi, $addlocal) {
109
+ if ($addlocal -eq "service") {
110
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefServiceFeature`"" -Passthru -Wait
111
+ }
112
+ ElseIf ($addlocal -eq "task") {
113
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefSchTaskFeature`"" -Passthru -Wait
114
+ }
115
+ ElseIf ($addlocal -eq "auto") {
116
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait
117
+ }
118
+
107
119
  $p.WaitForExit()
108
120
  if ($p.ExitCode -eq 1618) {
109
121
  Write-Host "Another msi install is in progress (exit code 1618), retrying ($($installAttempts))..."
@@ -61,6 +61,8 @@ module Mixlib
61
61
  def initialize(options)
62
62
  @options = options
63
63
 
64
+ map_windows_desktop_versions! if for_windows?
65
+
64
66
  validate!
65
67
  end
66
68
 
@@ -91,6 +93,7 @@ module Mixlib
91
93
  def for_ps1?
92
94
  platform == "windows" || shell_type == :ps1
93
95
  end
96
+ alias_method :for_windows?, :for_ps1?
94
97
 
95
98
  def latest_version?
96
99
  product_version.to_sym == :latest
@@ -174,6 +177,25 @@ Must be one of: #{SUPPORTED_SHELL_TYPES.join(", ")}
174
177
 
175
178
  error
176
179
  end
180
+
181
+ def map_windows_desktop_versions!
182
+ # This logic does not try to compare and determine proper versions based on conditions or ranges.
183
+ # These are here to improve UX for older desktop versions.
184
+ options[:platform_version] = case platform_version
185
+ when /^10/
186
+ "2016"
187
+ when /^6.3/, /^8.1/
188
+ "2012r2"
189
+ when /^6.2/, /^8/
190
+ "2012"
191
+ when /^6.1/, /^7/
192
+ "2008r2"
193
+ when /^6/
194
+ "2008"
195
+ else
196
+ platform_version
197
+ end
198
+ end
177
199
  end
178
200
  end
179
201
  end
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "2.1.6"
3
+ VERSION = "2.1.7"
4
4
  end
5
5
  end
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.6
4
+ version: 2.1.7
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-11-04 00:00:00.000000000 Z
12
+ date: 2016-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: artifactory
@@ -220,6 +220,7 @@ files:
220
220
  - ".gitignore"
221
221
  - ".rspec"
222
222
  - ".travis.yml"
223
+ - CHANGELOG.html
223
224
  - CHANGELOG.md
224
225
  - CONTRIBUTING.md
225
226
  - Gemfile
@@ -309,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
310
  version: '0'
310
311
  requirements: []
311
312
  rubyforge_project:
312
- rubygems_version: 2.4.5.1
313
+ rubygems_version: 2.6.6
313
314
  signing_key:
314
315
  specification_version: 4
315
316
  summary: A mixin to help with omnitruck installs