lib/mixlib/install/backend/base.rb in mixlib-install-3.0.0 vs lib/mixlib/install/backend/base.rb in mixlib-install-3.1.0

- old
+ new

@@ -24,12 +24,10 @@ class ArtifactsNotFound < StandardError; end class Base attr_reader :options - SUPPORTED_WINDOWS_DESKTOP_VERSIONS = %w{7 8 8.1 10} - def initialize(options) @options = options end # @@ -121,18 +119,18 @@ # we are going to use it. if options.platform_version_compatibility_mode && closest_compatible_artifact return closest_compatible_artifact end - # Return an exception if we get to the end of the method + # Return an exception if we get to the end of the method raise ArtifactsNotFound, <<-EOF No artifacts found matching criteria. product name: #{options.product_name} channel: #{options.channel} version: #{options.product_version} platform: #{options.platform} - platform version: #{options.platform_version} + platform version: #{options.original_platform_version} architecture: #{options.architecture} compatibility mode: #{options.platform_version_compatibility_mode} EOF end @@ -144,10 +142,19 @@ # def windows_artifact_fixup!(artifacts) new_artifacts = [ ] native_artifacts = [ ] + # We only return appx packages when a nano platform version is requested. + if options.class::SUPPORTED_WINDOWS_NANO_VERSIONS.include?(options.original_platform_version) + return artifacts.find_all { |a| a.appx_artifact? } + + # Otherwise, we only return msi artifacts and remove all appx packages + else + artifacts.delete_if { |a| a.appx_artifact? } + end + artifacts.each do |r| next if r.platform != "windows" # Store all native 64-bit artifacts and clone 32-bit artifacts to # be used as 64-bit. @@ -239,11 +246,11 @@ # # Custom map Chef's supported windows desktop versions to the server versions we currently build # See https://docs.chef.io/platforms.html # def map_custom_windows_desktop_versions(desktop_version) - server_version = Util.map_windows_desktop_version(desktop_version) + server_version = Util.map_windows_version(desktop_version) # Windows desktop 10 officially maps to server 2016. # However, we don't test on server 2016 at this time, so we default to 2012r2 server_version = "2012r2" if server_version == "2016" @@ -253,10 +260,10 @@ # # Clone all supported Windows desktop artifacts from a base artifact # options hash allows overriding any valid attribute # def clone_windows_desktop_artifacts(base_artifact, options = {}) - SUPPORTED_WINDOWS_DESKTOP_VERSIONS.collect do |dv| + @options.class::SUPPORTED_WINDOWS_DESKTOP_VERSIONS.collect do |dv| options[:platform_version] = dv options[:url] = base_artifact.url.gsub("\/#{base_artifact.platform_version}\/", "\/#{map_custom_windows_desktop_versions(dv)}\/") base_artifact.clone_with(options) end