mixlib-install 2.1.10 → 2.1.11

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: 33aae15f046862d9ff419e37d41aaa29b81d6c6d
4
- data.tar.gz: fdc1c8caca3ae66346623fd46021ddb6f42b3180
3
+ metadata.gz: 78100fdfcf4f2f4138a8c837ce334bfbb812f589
4
+ data.tar.gz: 4cc8e261d9e76e6fbacb66948b7c2013902c29cb
5
5
  SHA512:
6
- metadata.gz: 83ce80b409838a649904703c165dc194e4749789df457172141fc39c089590f830fcf6b30c2e97d1d6c703a117209b0e7875ab1441950874b7c56b786baf29b6
7
- data.tar.gz: 3c866560cf575ec0314a9495689194d913b775a341ec31ba4250358fd704894df0afd2d872f4e9917136156c7bd9af84615ecea1505a8c5c0d62ef4c1255e10a
6
+ metadata.gz: 1c49e9e1d76860d6f046f8802787afb24c5f43dfd68282790159af34fe7d97696cfacdbf93b5771e2f75c6564905b09c0f3046ef6fac57dc9f47d0de55b311c4
7
+ data.tar.gz: d3294be5f080deb190f45c2081e59feea6e8f5d2a6267278cc5fa8626e4addcd28e0b3979cc2f2823b8578829447d4faf74efea75b7d7db723fe256983e0c551
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## [2.1.11]
4
+ - Fix ScriptGenerator install script to use proper platform detection for Windows artifacts
5
+ - Artifact metadata now includes supported Windows Desktop versions
6
+
3
7
  ## [2.1.10]
4
8
  - Backward and forward compatibility support for `automate` and `delivery` product versions.
5
9
 
@@ -16,12 +16,18 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
+ require "mixlib/install/util"
20
+
19
21
  module Mixlib
20
22
  class Install
21
23
  class Backend
22
24
  class Base
25
+ class UnsupportedVersion < ArgumentError; end
26
+
23
27
  attr_reader :options
24
28
 
29
+ SUPPORTED_WINDOWS_DESKTOP_VERSIONS = %w{7 8 8.1 10}
30
+
25
31
  def initialize(options)
26
32
  @options = options
27
33
  end
@@ -124,6 +130,9 @@ module Mixlib
124
130
  # On windows, if we do not have a native 64-bit package available
125
131
  # in the discovered artifacts, we will make 32-bit artifacts available
126
132
  # for 64-bit architecture.
133
+ #
134
+ # We also create new artifacts for windows 7, 8, 8.1 and 10
135
+ #
127
136
  def windows_artifact_fixup!(artifacts)
128
137
  new_artifacts = [ ]
129
138
  native_artifacts = [ ]
@@ -143,6 +152,26 @@ module Mixlib
143
152
  end
144
153
  end
145
154
 
155
+ # Grab windows artifact for each architecture so we don't have to manipulate
156
+ # the architecture extension in the filename of the url which changes based on product.
157
+ # Don't want to deal with that!
158
+ artifact_64 = artifacts.find { |a| a.platform == "windows" && a.architecture == "x86_64" }
159
+ artifact_32 = artifacts.find { |a| a.platform == "windows" && a.architecture == "i386" }
160
+
161
+ # Attempt to clone windows artifacts only when a Windows 32 bit artifact exists
162
+ if artifact_32
163
+ new_artifacts.concat(clone_windows_desktop_artifacts(artifact_32))
164
+
165
+ # Clone an existing 64 bit artifact
166
+ if artifact_64
167
+ new_artifacts.concat(clone_windows_desktop_artifacts(artifact_64))
168
+
169
+ # Clone the 32 bit artifact when 64 bit doesn't exist
170
+ else
171
+ new_artifacts.concat(clone_windows_desktop_artifacts(artifact_32, architecture: "x86_64"))
172
+ end
173
+ end
174
+
146
175
  # Now discard the cloned artifacts if we find an equivalent native
147
176
  # artifact
148
177
  native_artifacts.each do |r|
@@ -195,6 +224,39 @@ module Mixlib
195
224
  architecture
196
225
  end
197
226
  end
227
+
228
+ private
229
+
230
+ #
231
+ # Custom map Chef's supported windows desktop versions to the server versions we currently build
232
+ # See https://docs.chef.io/platforms.html
233
+ #
234
+ def map_custom_windows_desktop_versions(desktop_version)
235
+ unless SUPPORTED_WINDOWS_DESKTOP_VERSIONS.include?(desktop_version)
236
+ raise UnsupportedVersion, "Unsupported Windows desktop version `#{desktop_version}`. Supported versions: #{SUPPORTED_WINDOWS_DESKTOP_VERSIONS.join(", ")}."
237
+ end
238
+
239
+ server_version = Util.map_windows_desktop_version(desktop_version)
240
+
241
+ # Windows desktop 10 officially maps to server 2016.
242
+ # However, we don't test on server 2016 at this time, so we default to 2012r2
243
+ server_version = "2012r2" if server_version == "2016"
244
+
245
+ server_version
246
+ end
247
+
248
+ #
249
+ # Clone all supported Windows desktop artifacts from a base artifact
250
+ # options hash allows overriding any valid attribute
251
+ #
252
+ def clone_windows_desktop_artifacts(base_artifact, options = {})
253
+ SUPPORTED_WINDOWS_DESKTOP_VERSIONS.collect do |dv|
254
+ options[:platform_version] = dv
255
+ options[:url] = base_artifact.url.gsub("\/#{base_artifact.platform_version}\/", "\/#{map_custom_windows_desktop_versions(dv)}\/")
256
+
257
+ base_artifact.clone_with(options)
258
+ end
259
+ end
198
260
  end
199
261
  end
200
262
  end
@@ -17,6 +17,7 @@
17
17
  #
18
18
 
19
19
  require "mixlib/install/product"
20
+ require "mixlib/install/util"
20
21
  require "mixlib/versioning"
21
22
 
22
23
  module Mixlib
@@ -179,22 +180,7 @@ Must be one of: #{SUPPORTED_SHELL_TYPES.join(", ")}
179
180
  end
180
181
 
181
182
  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
183
+ options[:platform_version] = Util.map_windows_desktop_version(platform_version)
198
184
  end
199
185
  end
200
186
  end
@@ -18,6 +18,7 @@
18
18
  #
19
19
 
20
20
  require "mixlib/install/util"
21
+ require "mixlib/install/generator/powershell"
21
22
  require "cgi"
22
23
 
23
24
  module Mixlib
@@ -171,8 +172,23 @@ module Mixlib
171
172
  %w{.. .. .. support},
172
173
  "install_command"
173
174
  )
174
- Util.shell_code_from_file(vars, fn, powershell,
175
- http_proxy: http_proxy, https_proxy: https_proxy)
175
+ code = Util.shell_code_from_file(
176
+ vars, fn, powershell,
177
+ http_proxy: http_proxy, https_proxy: https_proxy
178
+ )
179
+ powershell ? powershell_prefix.concat(code) : code
180
+ end
181
+
182
+ # Prefixes the PowerShell install script with helpers and shell vars
183
+ # to detect the platform version and architecture.
184
+ #
185
+ # @return [String] PowerShell helpers and shell vars for platform info
186
+ def powershell_prefix
187
+ [
188
+ Mixlib::Install::Generator::PowerShell.get_script("helpers.ps1"),
189
+ "$platform_architecture = Get-PlatformArchitecture",
190
+ "$platform_version = Get-PlatformVersion",
191
+ ].join("\n")
176
192
  end
177
193
 
178
194
  # Builds a shell variable assignment string for the required shell type.
@@ -200,7 +216,7 @@ module Mixlib
200
216
  end
201
217
 
202
218
  url = "#{base}#{endpoint}"
203
- url << "?p=windows&m=x86_64&pv=2008r2" # same package for all versions
219
+ url << "?p=windows&m=$platform_architecture&pv=$platform_version"
204
220
  url << "&v=#{CGI.escape(version)}" unless %w{latest true nightlies}.include?(version)
205
221
  url << "&prerelease=true" if prerelease
206
222
  url << "&nightlies=true" if nightlies
@@ -129,6 +129,25 @@ module Mixlib
129
129
  # Ensure that if the default user agent is aleady set it doesn't get duplicated
130
130
  user_agents.flatten.compact.uniq.join(" ")
131
131
  end
132
+
133
+ def map_windows_desktop_version(version)
134
+ # This logic does not try to compare and determine proper versions based on conditions or ranges.
135
+ # These are here to improve UX for desktop versions.
136
+ case version
137
+ when /^10/
138
+ "2016"
139
+ when /^6.3/, /^8.1/
140
+ "2012r2"
141
+ when /^6.2/, /^8/
142
+ "2012"
143
+ when /^6.1/, /^7/
144
+ "2008r2"
145
+ when /^6/
146
+ "2008"
147
+ else
148
+ version
149
+ end
150
+ end
132
151
  end
133
152
  end
134
153
  end
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "2.1.10"
3
+ VERSION = "2.1.11"
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.10
4
+ version: 2.1.11
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: 2017-01-24 00:00:00.000000000 Z
12
+ date: 2017-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: artifactory
@@ -220,7 +220,6 @@ files:
220
220
  - ".gitignore"
221
221
  - ".rspec"
222
222
  - ".travis.yml"
223
- - CHANGELOG.html
224
223
  - CHANGELOG.md
225
224
  - CONTRIBUTING.md
226
225
  - Gemfile
@@ -290,7 +289,6 @@ files:
290
289
  - mixlib-install.gemspec
291
290
  - support/install_command.ps1
292
291
  - support/install_command.sh
293
- - terraform_0.7.4_linux_amd64.zip
294
292
  homepage: https://chef.io
295
293
  licenses:
296
294
  - Apache-2.0