mixlib-install 2.1.12 → 3.0.0
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 +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +15 -0
- data/lib/mixlib/install/backend/base.rb +15 -10
- data/lib/mixlib/install/backend/package_router.rb +12 -16
- data/lib/mixlib/install/cli.rb +11 -16
- data/lib/mixlib/install/options.rb +61 -23
- data/lib/mixlib/install/product.rb +46 -3
- data/lib/mixlib/install/version.rb +1 -1
- data/mixlib-install.gemspec +1 -2
- metadata +5 -18
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 085161439c62c8a919ce8fd06074c085188d9335
         | 
| 4 | 
            +
              data.tar.gz: 0f728caf3f8d6c8ce78dea5e8b627acb95febc05
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ebcdac43be5b9a3b0b335d81b77afd8a442309b6c28f95f7db3a1564e5c810809755dce7f25aeff924cac8e2d575d2c73110006f87a77a77991e4ade20e4645c
         | 
| 7 | 
            +
              data.tar.gz: 87e953ca7d176419053774b3f3515c161b786dba36442dcd7b7cdad87fb5e337b11177ae0b208e740d5a3d9980f7672aa09678a181caa7ab85e966a7cb8dad79
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,9 +1,15 @@ | |
| 1 1 | 
             
            # Change Log
         | 
| 2 2 |  | 
| 3 | 
            +
            ## [3.0.0]
         | 
| 4 | 
            +
            - [Breaking API Change] `Options` validation added to ensure that when any platform option is set they are all provided (platform, platform_version, architecture)
         | 
| 5 | 
            +
            - [Breaking API Change] The `platform_version_compatibility_mode` option will automatically be set to `true` when no platform options are provided
         | 
| 6 | 
            +
            - [Breaking API Change] Queries for aritfacts that yield no results will raise an exception (`Mixlib::Install::Backend::ArtifactsNotFound`) versus returning an empty array
         | 
| 7 | 
            +
            - New properties added to `Products`: `github_repo` and `downloads_product_page_url`
         | 
| 8 | 
            +
            - New method for retrieving products that are available on downloads.chef.io: `PRODUCT_MATRIX.products_available_on_downloads_site`
         | 
| 9 | 
            +
             | 
| 3 10 | 
             
            ## [2.1.12]
         | 
| 4 11 | 
             
            - Force powershell scripts to ASCII encode variables
         | 
| 5 12 |  | 
| 6 | 
            -
             | 
| 7 13 | 
             
            ## [2.1.11]
         | 
| 8 14 | 
             
            - Fix ScriptGenerator install script to use proper platform detection for Windows artifacts
         | 
| 9 15 | 
             
            - Artifact metadata now includes supported Windows Desktop versions
         | 
    
        data/README.md
    CHANGED
    
    | @@ -83,6 +83,21 @@ artifact.platform # => "ubuntu" | |
| 83 83 | 
             
            artifact.platform_version # => "14.04"
         | 
| 84 84 | 
             
            ```
         | 
| 85 85 |  | 
| 86 | 
            +
            `platform_version_compatibility_mode` will automatically be enabled if platform options are not specified.
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            If running on Ubuntu 15.04...
         | 
| 89 | 
            +
            ```ruby
         | 
| 90 | 
            +
            options = {
         | 
| 91 | 
            +
              channel: :current,
         | 
| 92 | 
            +
              product_name: 'chef',
         | 
| 93 | 
            +
            }
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            artifact = Mixlib::Install.new(options).artifact_info
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            artifact.platform # => "ubuntu"
         | 
| 98 | 
            +
            artifact.platform_version # => "14.04"
         | 
| 99 | 
            +
            ```
         | 
| 100 | 
            +
             | 
| 86 101 | 
             
            ### List the available versions for a product and channel
         | 
| 87 102 | 
             
            #### Instance method
         | 
| 88 103 | 
             
            ```ruby
         | 
| @@ -21,9 +21,9 @@ require "mixlib/install/util" | |
| 21 21 | 
             
            module Mixlib
         | 
| 22 22 | 
             
              class Install
         | 
| 23 23 | 
             
                class Backend
         | 
| 24 | 
            -
                  class  | 
| 25 | 
            -
                    class UnsupportedVersion < ArgumentError; end
         | 
| 24 | 
            +
                  class ArtifactsNotFound < StandardError; end
         | 
| 26 25 |  | 
| 26 | 
            +
                  class Base
         | 
| 27 27 | 
             
                    attr_reader :options
         | 
| 28 28 |  | 
| 29 29 | 
             
                    SUPPORTED_WINDOWS_DESKTOP_VERSIONS = %w{7 8 8.1 10}
         | 
| @@ -79,10 +79,10 @@ module Mixlib | |
| 79 79 | 
             
                    # Filters and returns the available artifacts based on the configured
         | 
| 80 80 | 
             
                    # platform filtering options.
         | 
| 81 81 | 
             
                    #
         | 
| 82 | 
            -
                    # @return ArtifactInfo, Array<ArtifactInfo>,  | 
| 82 | 
            +
                    # @return ArtifactInfo, Array<ArtifactInfo>, ArtifactsNotFound
         | 
| 83 83 | 
             
                    #   If the result is a single artifact, this returns ArtifactInfo.
         | 
| 84 84 | 
             
                    #   If the result is a list of artifacts, this returns Array<ArtifactInfo>.
         | 
| 85 | 
            -
                    #   If no suitable artifact is found, this returns  | 
| 85 | 
            +
                    #   If no suitable artifact is found, this returns ArtifactsNotFound exception.
         | 
| 86 86 | 
             
                    def filter_artifacts(artifacts)
         | 
| 87 87 | 
             
                      return artifacts unless platform_filters_available?
         | 
| 88 88 |  | 
| @@ -123,8 +123,17 @@ module Mixlib | |
| 123 123 | 
             
                        return closest_compatible_artifact
         | 
| 124 124 | 
             
                      end
         | 
| 125 125 |  | 
| 126 | 
            -
                       #  | 
| 127 | 
            -
                       | 
| 126 | 
            +
                       # Return an exception if we get to the end of the method
         | 
| 127 | 
            +
                      raise ArtifactsNotFound, <<-EOF
         | 
| 128 | 
            +
            No artifacts found matching criteria.
         | 
| 129 | 
            +
              product name: #{options.product_name}
         | 
| 130 | 
            +
              channel: #{options.channel}
         | 
| 131 | 
            +
              version: #{options.product_version}
         | 
| 132 | 
            +
              platform: #{options.platform}
         | 
| 133 | 
            +
              platform version: #{options.platform_version}
         | 
| 134 | 
            +
              architecture: #{options.architecture}
         | 
| 135 | 
            +
              compatibility mode: #{options.platform_version_compatibility_mode}
         | 
| 136 | 
            +
            EOF
         | 
| 128 137 | 
             
                    end
         | 
| 129 138 |  | 
| 130 139 | 
             
                    # On windows, if we do not have a native 64-bit package available
         | 
| @@ -232,10 +241,6 @@ module Mixlib | |
| 232 241 | 
             
                    # See https://docs.chef.io/platforms.html
         | 
| 233 242 | 
             
                    #
         | 
| 234 243 | 
             
                    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 244 | 
             
                      server_version = Util.map_windows_desktop_version(desktop_version)
         | 
| 240 245 |  | 
| 241 246 | 
             
                      # Windows desktop 10 officially maps to server 2016.
         | 
| @@ -27,8 +27,6 @@ module Mixlib | |
| 27 27 | 
             
              class Install
         | 
| 28 28 | 
             
                class Backend
         | 
| 29 29 | 
             
                  class PackageRouter < Base
         | 
| 30 | 
            -
                    class NoArtifactsError < StandardError; end
         | 
| 31 | 
            -
             | 
| 32 30 | 
             
                    ENDPOINT = "https://packages.chef.io".freeze
         | 
| 33 31 |  | 
| 34 32 | 
             
                    COMPAT_DOWNLOAD_URL_ENDPOINT = "http://packages.chef.io".freeze
         | 
| @@ -66,6 +64,15 @@ module Mixlib | |
| 66 64 | 
             
                    def versions
         | 
| 67 65 | 
             
                      items = get("/api/v1/#{options.channel}/#{omnibus_project}/versions")["results"]
         | 
| 68 66 |  | 
| 67 | 
            +
                      # Circumvent early when there are no product artifacts in a specific channel
         | 
| 68 | 
            +
                      if items.empty?
         | 
| 69 | 
            +
                        raise ArtifactsNotFound, <<-EOF
         | 
| 70 | 
            +
            No artifacts found matching criteria.
         | 
| 71 | 
            +
              product name: #{options.product_name}
         | 
| 72 | 
            +
              channel: #{options.channel}
         | 
| 73 | 
            +
            EOF
         | 
| 74 | 
            +
                      end
         | 
| 75 | 
            +
             | 
| 69 76 | 
             
                      # Filter out the partial builds if we are in :unstable channel
         | 
| 70 77 | 
             
                      # In other channels we do not need to do this since all builds are
         | 
| 71 78 | 
             
                      # always complete. Infact we should not do this since for some arcane
         | 
| @@ -76,6 +83,7 @@ module Mixlib | |
| 76 83 | 
             
                        # populated with the build record if "artifact.module.build" exists.
         | 
| 77 84 | 
             
                        items.reject! { |i| i["artifacts"].nil? }
         | 
| 78 85 | 
             
                      end
         | 
| 86 | 
            +
             | 
| 79 87 | 
             
                      items
         | 
| 80 88 | 
             
                    end
         | 
| 81 89 |  | 
| @@ -84,21 +92,9 @@ module Mixlib | |
| 84 92 | 
             
                    #
         | 
| 85 93 | 
             
                    # @return [Array<ArtifactInfo>] Array of info about found artifacts
         | 
| 86 94 | 
             
                    def latest_version
         | 
| 87 | 
            -
                      # Get the list of builds from the REST api.
         | 
| 88 | 
            -
                      # We do this because a user in the readers group does not have
         | 
| 89 | 
            -
                      # permissions to run aql against builds.
         | 
| 90 | 
            -
                      builds = versions
         | 
| 91 | 
            -
             | 
| 92 | 
            -
                      if builds.nil?
         | 
| 93 | 
            -
                        raise NoArtifactsError, <<-MSG
         | 
| 94 | 
            -
            Can not find any builds for #{options.product_name} in #{endpoint}.
         | 
| 95 | 
            -
                        MSG
         | 
| 96 | 
            -
                      end
         | 
| 97 | 
            -
             | 
| 98 95 | 
             
                      # Sort by created data
         | 
| 99 | 
            -
                       | 
| 100 | 
            -
                       | 
| 101 | 
            -
                      version = extract_version_from_response(builds.first)
         | 
| 96 | 
            +
                      sorted_versions = versions.sort_by! { |b| b["created"] }.reverse!
         | 
| 97 | 
            +
                      version = extract_version_from_response(sorted_versions.first)
         | 
| 102 98 | 
             
                      artifacts_for_version(version)
         | 
| 103 99 | 
             
                    end
         | 
| 104 100 |  | 
    
        data/lib/mixlib/install/cli.rb
    CHANGED
    
    | @@ -49,32 +49,27 @@ If no earlier version is found the earliest version available will be set.", | |
| 49 49 | 
             
                    desc: "Print artifact attributes",
         | 
| 50 50 | 
             
                    type: :boolean
         | 
| 51 51 | 
             
                  def download(product_name)
         | 
| 52 | 
            -
                    say_status("Warn", "Product key `delivery` will be deprecated in a future release. Please use `automate`") if product_name == "delivery"
         | 
| 53 52 | 
             
                    # Set mininum options
         | 
| 54 53 | 
             
                    mixlib_install_options = {
         | 
| 55 54 | 
             
                      channel: options[:channel].to_sym,
         | 
| 56 55 | 
             
                      product_name: product_name,
         | 
| 57 56 | 
             
                      product_version: options[:version],
         | 
| 58 57 | 
             
                      platform_version_compatibility_mode: options[:platform_version_compat],
         | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
                        abort "Must provide platform version and architecture when specifying a platform"
         | 
| 65 | 
            -
                      end
         | 
| 66 | 
            -
                      mixlib_install_options[:platform] = options[:platform]
         | 
| 67 | 
            -
                      mixlib_install_options[:platform_version] = options[:platform_version]
         | 
| 68 | 
            -
                      mixlib_install_options[:architecture] = options[:architecture]
         | 
| 69 | 
            -
                    else
         | 
| 58 | 
            +
                      architecture: options[:architecture],
         | 
| 59 | 
            +
                    }.tap do |opt|
         | 
| 60 | 
            +
                      opt[:platform] = options[:platform] if options[:platform]
         | 
| 61 | 
            +
                      opt[:platform_version] = options[:platform_version] if options[:platform_version]
         | 
| 62 | 
            +
                    end
         | 
| 70 63 |  | 
| 64 | 
            +
                    # auto detect platform options if not configured
         | 
| 65 | 
            +
                    if options[:platform].nil? && options[:platform_version].nil?
         | 
| 71 66 | 
             
                      mixlib_install_options.merge!(Mixlib::Install.detect_platform)
         | 
| 72 67 | 
             
                    end
         | 
| 73 68 |  | 
| 74 | 
            -
                     | 
| 75 | 
            -
             | 
| 76 | 
            -
                     | 
| 77 | 
            -
                      abort  | 
| 69 | 
            +
                    begin
         | 
| 70 | 
            +
                      artifact = Mixlib::Install.new(mixlib_install_options).artifact_info
         | 
| 71 | 
            +
                    rescue Mixlib::Install::Backend::ArtifactsNotFound => e
         | 
| 72 | 
            +
                      abort e.message
         | 
| 78 73 | 
             
                    end
         | 
| 79 74 |  | 
| 80 75 | 
             
                    if options[:url]
         | 
| @@ -25,7 +25,7 @@ module Mixlib | |
| 25 25 | 
             
                class Options
         | 
| 26 26 | 
             
                  class InvalidOptions < ArgumentError; end
         | 
| 27 27 |  | 
| 28 | 
            -
                  attr_reader :options
         | 
| 28 | 
            +
                  attr_reader :options, :errors
         | 
| 29 29 |  | 
| 30 30 | 
             
                  SUPPORTED_ARCHITECTURES = %w{
         | 
| 31 31 | 
             
                    i386
         | 
| @@ -36,12 +36,15 @@ module Mixlib | |
| 36 36 | 
             
                    sparc
         | 
| 37 37 | 
             
                    x86_64
         | 
| 38 38 | 
             
                  }
         | 
| 39 | 
            +
             | 
| 39 40 | 
             
                  SUPPORTED_CHANNELS = [
         | 
| 40 41 | 
             
                    :stable,
         | 
| 41 42 | 
             
                    :current,
         | 
| 42 43 | 
             
                    :unstable,
         | 
| 43 44 | 
             
                  ]
         | 
| 45 | 
            +
             | 
| 44 46 | 
             
                  SUPPORTED_PRODUCT_NAMES = PRODUCT_MATRIX.products
         | 
| 47 | 
            +
             | 
| 45 48 | 
             
                  SUPPORTED_SHELL_TYPES = [
         | 
| 46 49 | 
             
                    :ps1,
         | 
| 47 50 | 
             
                    :sh,
         | 
| @@ -61,34 +64,34 @@ module Mixlib | |
| 61 64 |  | 
| 62 65 | 
             
                  def initialize(options)
         | 
| 63 66 | 
             
                    @options = options
         | 
| 67 | 
            +
                    @errors = []
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                    resolve_platform_version_compatibility_mode!
         | 
| 64 70 |  | 
| 65 71 | 
             
                    map_windows_desktop_versions! if for_windows?
         | 
| 66 72 |  | 
| 67 73 | 
             
                    validate!
         | 
| 68 74 | 
             
                  end
         | 
| 69 75 |  | 
| 76 | 
            +
                  SUPPORTED_OPTIONS.each do |option|
         | 
| 77 | 
            +
                    define_method option do
         | 
| 78 | 
            +
                      options[option] || options[option.to_s] || default_options[option]
         | 
| 79 | 
            +
                    end
         | 
| 80 | 
            +
                  end
         | 
| 81 | 
            +
             | 
| 70 82 | 
             
                  def validate!
         | 
| 71 83 | 
             
                    validate_options!
         | 
| 72 84 | 
             
                  end
         | 
| 73 85 |  | 
| 74 86 | 
             
                  def validate_options!
         | 
| 75 | 
            -
                     | 
| 76 | 
            -
             | 
| 77 | 
            -
                     | 
| 78 | 
            -
                     | 
| 79 | 
            -
                     | 
| 80 | 
            -
                     | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
                    unless errors.compact.empty?
         | 
| 84 | 
            -
                      raise InvalidOptions, errors.join("\n")
         | 
| 85 | 
            -
                    end
         | 
| 86 | 
            -
                  end
         | 
| 87 | 
            -
             | 
| 88 | 
            -
                  SUPPORTED_OPTIONS.each do |option|
         | 
| 89 | 
            -
                    define_method option do
         | 
| 90 | 
            -
                      options[option] || options[option.to_s] || default_options[option]
         | 
| 91 | 
            -
                    end
         | 
| 87 | 
            +
                    validate_architecture
         | 
| 88 | 
            +
                    validate_product_names
         | 
| 89 | 
            +
                    validate_channels
         | 
| 90 | 
            +
                    validate_shell_type
         | 
| 91 | 
            +
                    validate_user_agent_headers
         | 
| 92 | 
            +
                    validate_platform_options
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                    raise InvalidOptions, errors.join("\n") unless errors.empty?
         | 
| 92 95 | 
             
                  end
         | 
| 93 96 |  | 
| 94 97 | 
             
                  def for_ps1?
         | 
| @@ -117,6 +120,29 @@ module Mixlib | |
| 117 120 | 
             
                    validate_options!
         | 
| 118 121 | 
             
                  end
         | 
| 119 122 |  | 
| 123 | 
            +
                  def platform_info
         | 
| 124 | 
            +
                    {
         | 
| 125 | 
            +
                      platform: options[:platform],
         | 
| 126 | 
            +
                      platform_version: options[:platform_version],
         | 
| 127 | 
            +
                      architecture: options[:architecture],
         | 
| 128 | 
            +
                    }
         | 
| 129 | 
            +
                  end
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                  #
         | 
| 132 | 
            +
                  # Calling this method will give queries more of an opportunity to collect
         | 
| 133 | 
            +
                  # compatible artifacts where there may not always be an exact match.
         | 
| 134 | 
            +
                  #
         | 
| 135 | 
            +
                  # This option is set to false by default.
         | 
| 136 | 
            +
                  # - In cases where no platform options are configured it will set this option to true.
         | 
| 137 | 
            +
                  # - In cases where all platform options are configured it will remain false UNLESS the option
         | 
| 138 | 
            +
                  #   has been configured to be true.
         | 
| 139 | 
            +
                  #
         | 
| 140 | 
            +
                  def resolve_platform_version_compatibility_mode!
         | 
| 141 | 
            +
                    unless options[:platform_version_compatibility_mode]
         | 
| 142 | 
            +
                      options[:platform_version_compatibility_mode] = true if platform_info.values.none?
         | 
| 143 | 
            +
                    end
         | 
| 144 | 
            +
                  end
         | 
| 145 | 
            +
             | 
| 120 146 | 
             
                  private
         | 
| 121 147 |  | 
| 122 148 | 
             
                  def default_options
         | 
| @@ -130,7 +156,7 @@ module Mixlib | |
| 130 156 |  | 
| 131 157 | 
             
                  def validate_architecture
         | 
| 132 158 | 
             
                    unless architecture.nil? || SUPPORTED_ARCHITECTURES.include?(architecture)
         | 
| 133 | 
            -
                      <<-EOS
         | 
| 159 | 
            +
                      errors << <<-EOS
         | 
| 134 160 | 
             
            Unknown architecture #{architecture}.
         | 
| 135 161 | 
             
            Must be one of: #{SUPPORTED_ARCHITECTURES.join(", ")}
         | 
| 136 162 | 
             
                      EOS
         | 
| @@ -139,7 +165,7 @@ Must be one of: #{SUPPORTED_ARCHITECTURES.join(", ")} | |
| 139 165 |  | 
| 140 166 | 
             
                  def validate_product_names
         | 
| 141 167 | 
             
                    unless SUPPORTED_PRODUCT_NAMES.include? product_name
         | 
| 142 | 
            -
                      <<-EOS
         | 
| 168 | 
            +
                      errors << <<-EOS
         | 
| 143 169 | 
             
            Unknown product name #{product_name}.
         | 
| 144 170 | 
             
            Must be one of: #{SUPPORTED_PRODUCT_NAMES.join(", ")}
         | 
| 145 171 | 
             
                      EOS
         | 
| @@ -148,7 +174,7 @@ Must be one of: #{SUPPORTED_PRODUCT_NAMES.join(", ")} | |
| 148 174 |  | 
| 149 175 | 
             
                  def validate_channels
         | 
| 150 176 | 
             
                    unless SUPPORTED_CHANNELS.include? channel
         | 
| 151 | 
            -
                      <<-EOS
         | 
| 177 | 
            +
                      errors << <<-EOS
         | 
| 152 178 | 
             
            Unknown channel #{channel}.
         | 
| 153 179 | 
             
            Must be one of: #{SUPPORTED_CHANNELS.join(", ")}
         | 
| 154 180 | 
             
                      EOS
         | 
| @@ -157,7 +183,7 @@ Must be one of: #{SUPPORTED_CHANNELS.join(", ")} | |
| 157 183 |  | 
| 158 184 | 
             
                  def validate_shell_type
         | 
| 159 185 | 
             
                    unless SUPPORTED_SHELL_TYPES.include? shell_type
         | 
| 160 | 
            -
                      <<-EOS
         | 
| 186 | 
            +
                      errors << <<-EOS
         | 
| 161 187 | 
             
            Unknown shell type.
         | 
| 162 188 | 
             
            Must be one of: #{SUPPORTED_SHELL_TYPES.join(", ")}
         | 
| 163 189 | 
             
                      EOS
         | 
| @@ -176,12 +202,24 @@ Must be one of: #{SUPPORTED_SHELL_TYPES.join(", ")} | |
| 176 202 | 
             
                      end
         | 
| 177 203 | 
             
                    end
         | 
| 178 204 |  | 
| 179 | 
            -
                    error
         | 
| 205 | 
            +
                    errors << error if error
         | 
| 206 | 
            +
                  end
         | 
| 207 | 
            +
             | 
| 208 | 
            +
                  def validate_platform_options
         | 
| 209 | 
            +
                    unless all_or_none?(platform_info.values)
         | 
| 210 | 
            +
                      errors << <<-EOS
         | 
| 211 | 
            +
            Must provide platform, platform version and architecture when specifying any platform details
         | 
| 212 | 
            +
                      EOS
         | 
| 213 | 
            +
                    end
         | 
| 180 214 | 
             
                  end
         | 
| 181 215 |  | 
| 182 216 | 
             
                  def map_windows_desktop_versions!
         | 
| 183 217 | 
             
                    options[:platform_version] = Util.map_windows_desktop_version(platform_version)
         | 
| 184 218 | 
             
                  end
         | 
| 219 | 
            +
             | 
| 220 | 
            +
                  def all_or_none?(items)
         | 
| 221 | 
            +
                    items.all? || items.compact.empty?
         | 
| 222 | 
            +
                  end
         | 
| 185 223 | 
             
                end
         | 
| 186 224 | 
             
              end
         | 
| 187 225 | 
             
            end
         | 
| @@ -20,17 +20,21 @@ require "mixlib/versioning" | |
| 20 20 | 
             
            module Mixlib
         | 
| 21 21 | 
             
              class Install
         | 
| 22 22 | 
             
                class Product
         | 
| 23 | 
            -
                  def initialize(&block)
         | 
| 23 | 
            +
                  def initialize(key, &block)
         | 
| 24 | 
            +
                    @product_key = key
         | 
| 24 25 | 
             
                    instance_eval(&block)
         | 
| 25 26 | 
             
                  end
         | 
| 26 27 |  | 
| 27 28 | 
             
                  DSL_PROPERTIES = [
         | 
| 28 29 | 
             
                    :config_file,
         | 
| 29 30 | 
             
                    :ctl_command,
         | 
| 31 | 
            +
                    :product_key,
         | 
| 30 32 | 
             
                    :package_name,
         | 
| 31 33 | 
             
                    :product_name,
         | 
| 32 34 | 
             
                    :install_path,
         | 
| 33 35 | 
             
                    :omnibus_project,
         | 
| 36 | 
            +
                    :github_repo,
         | 
| 37 | 
            +
                    :downloads_product_page_url,
         | 
| 34 38 | 
             
                  ]
         | 
| 35 39 |  | 
| 36 40 | 
             
                  #
         | 
| @@ -53,7 +57,7 @@ module Mixlib | |
| 53 57 | 
             
                          value = instance_variable_get("@#{prop}".to_sym)
         | 
| 54 58 | 
             
                          return default_value_for(prop) if value.nil?
         | 
| 55 59 |  | 
| 56 | 
            -
                          if value.is_a?  | 
| 60 | 
            +
                          if value.is_a?(String) || value.is_a?(Symbol)
         | 
| 57 61 | 
             
                            value
         | 
| 58 62 | 
             
                          else
         | 
| 59 63 | 
             
                            value.call(version_for(version))
         | 
| @@ -77,6 +81,10 @@ module Mixlib | |
| 77 81 | 
             
                      "/opt/#{package_name}"
         | 
| 78 82 | 
             
                    when :omnibus_project
         | 
| 79 83 | 
             
                      package_name
         | 
| 84 | 
            +
                    when :downloads_product_page_url
         | 
| 85 | 
            +
                      "https://downloads.chef.io/#{product_key}"
         | 
| 86 | 
            +
                    when :github_repo
         | 
| 87 | 
            +
                      "chef/#{product_key}"
         | 
| 80 88 | 
             
                    else
         | 
| 81 89 | 
             
                      nil
         | 
| 82 90 | 
             
                    end
         | 
| @@ -132,7 +140,7 @@ module Mixlib | |
| 132 140 | 
             
                  # `key` and stores it.
         | 
| 133 141 | 
             
                  #
         | 
| 134 142 | 
             
                  def product(key, &block)
         | 
| 135 | 
            -
                    @product_map[key] = Product.new(&block)
         | 
| 143 | 
            +
                    @product_map[key] = Product.new(key, &block)
         | 
| 136 144 | 
             
                  end
         | 
| 137 145 |  | 
| 138 146 | 
             
                  #
         | 
| @@ -162,6 +170,18 @@ module Mixlib | |
| 162 170 | 
             
                    product.version(version)
         | 
| 163 171 | 
             
                    product
         | 
| 164 172 | 
             
                  end
         | 
| 173 | 
            +
             | 
| 174 | 
            +
                  #
         | 
| 175 | 
            +
                  # Looks up all products that are available on downloads.chef.io
         | 
| 176 | 
            +
                  #
         | 
| 177 | 
            +
                  # @return Hash{String => Product}
         | 
| 178 | 
            +
                  #   :key => product_key
         | 
| 179 | 
            +
                  #   :value => Mixlib::Install::Product instance
         | 
| 180 | 
            +
                  def products_available_on_downloads_site
         | 
| 181 | 
            +
                    @product_map.delete_if do |product_key, product|
         | 
| 182 | 
            +
                      product.downloads_product_page_url == :not_available
         | 
| 183 | 
            +
                    end
         | 
| 184 | 
            +
                  end
         | 
| 165 185 | 
             
                end
         | 
| 166 186 | 
             
              end
         | 
| 167 187 | 
             
            end
         | 
| @@ -179,16 +199,21 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 179 199 | 
             
                package_name "opscode-analytics"
         | 
| 180 200 | 
             
                ctl_command "opscode-analytics-ctl"
         | 
| 181 201 | 
             
                config_file "/etc/opscode-analytics/opscode-analytics.rb"
         | 
| 202 | 
            +
                downloads_product_page_url :not_available
         | 
| 182 203 | 
             
              end
         | 
| 183 204 |  | 
| 184 205 | 
             
              product "angry-omnibus-toolchain" do
         | 
| 185 206 | 
             
                product_name "Angry Omnibus Toolchain"
         | 
| 186 207 | 
             
                package_name "angry-omnibus-toolchain"
         | 
| 208 | 
            +
                github_repo "chef/omnibus-toolchain"
         | 
| 209 | 
            +
                downloads_product_page_url :not_available
         | 
| 187 210 | 
             
              end
         | 
| 188 211 |  | 
| 189 212 | 
             
              product "angrychef" do
         | 
| 190 213 | 
             
                product_name "Angry Chef Client"
         | 
| 191 214 | 
             
                package_name "angrychef"
         | 
| 215 | 
            +
                github_repo "chef/chef"
         | 
| 216 | 
            +
                downloads_product_page_url :not_available
         | 
| 192 217 | 
             
              end
         | 
| 193 218 |  | 
| 194 219 | 
             
              product "automate" do
         | 
| @@ -245,11 +270,13 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 245 270 | 
             
              product "chef-server-ha-provisioning" do
         | 
| 246 271 | 
             
                product_name "Chef Server HA Provisioning for AWS"
         | 
| 247 272 | 
             
                package_name "chef-server-ha-provisioning"
         | 
| 273 | 
            +
                downloads_product_page_url :not_available
         | 
| 248 274 | 
             
              end
         | 
| 249 275 |  | 
| 250 276 | 
             
              product "chefdk" do
         | 
| 251 277 | 
             
                product_name "Chef Development Kit"
         | 
| 252 278 | 
             
                package_name "chefdk"
         | 
| 279 | 
            +
                github_repo "chef/chef-dk"
         | 
| 253 280 | 
             
              end
         | 
| 254 281 |  | 
| 255 282 | 
             
              product "compliance" do
         | 
| @@ -269,17 +296,23 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 269 296 | 
             
                  v < version_for("0.7.0") ? "delivery-ctl" : "automate-ctl"
         | 
| 270 297 | 
             
                end
         | 
| 271 298 | 
             
                config_file "/etc/delivery/delivery.rb"
         | 
| 299 | 
            +
                github_repo "chef/automate"
         | 
| 300 | 
            +
                downloads_product_page_url "https://downloads.chef.io/automate"
         | 
| 272 301 | 
             
              end
         | 
| 273 302 |  | 
| 274 303 | 
             
              product "ha" do
         | 
| 275 304 | 
             
                product_name "Chef Server High Availability addon"
         | 
| 276 305 | 
             
                package_name "chef-ha"
         | 
| 277 306 | 
             
                config_file "/etc/opscode/chef-server.rb"
         | 
| 307 | 
            +
                github_repo "chef/chef-ha"
         | 
| 308 | 
            +
                downloads_product_page_url :not_available
         | 
| 278 309 | 
             
              end
         | 
| 279 310 |  | 
| 280 311 | 
             
              product "harmony" do
         | 
| 281 312 | 
             
                product_name "Harmony - Omnibus Integration Internal Test Project"
         | 
| 282 313 | 
             
                package_name "harmony"
         | 
| 314 | 
            +
                github_repo "chef/omnibus-harmony"
         | 
| 315 | 
            +
                downloads_product_page_url :not_available
         | 
| 283 316 | 
             
              end
         | 
| 284 317 |  | 
| 285 318 | 
             
              product "inspec" do
         | 
| @@ -302,6 +335,7 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 302 335 | 
             
                    "/etc/chef-manage/manage.rb"
         | 
| 303 336 | 
             
                  end
         | 
| 304 337 | 
             
                end
         | 
| 338 | 
            +
                github_repo "chef/chef-manage"
         | 
| 305 339 | 
             
              end
         | 
| 306 340 |  | 
| 307 341 | 
             
              product "marketplace" do
         | 
| @@ -309,11 +343,14 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 309 343 | 
             
                package_name "chef-marketplace"
         | 
| 310 344 | 
             
                ctl_command "chef-marketplace-ctl"
         | 
| 311 345 | 
             
                config_file "/etc/chef-marketplace/marketplace.rb"
         | 
| 346 | 
            +
                github_repo "chef-partners/omnibus-marketplace"
         | 
| 347 | 
            +
                downloads_product_page_url :not_available
         | 
| 312 348 | 
             
              end
         | 
| 313 349 |  | 
| 314 350 | 
             
              product "omnibus-toolchain" do
         | 
| 315 351 | 
             
                product_name "Omnibus Toolchain"
         | 
| 316 352 | 
             
                package_name "omnibus-toolchain"
         | 
| 353 | 
            +
                downloads_product_page_url :not_available
         | 
| 317 354 | 
             
              end
         | 
| 318 355 |  | 
| 319 356 | 
             
              product "private-chef" do
         | 
| @@ -322,6 +359,7 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 322 359 | 
             
                ctl_command "private-chef-ctl"
         | 
| 323 360 | 
             
                config_file "/etc/opscode/private-chef.rb"
         | 
| 324 361 | 
             
                install_path "/opt/opscode"
         | 
| 362 | 
            +
                github_repo "chef/opscode-chef"
         | 
| 325 363 | 
             
              end
         | 
| 326 364 |  | 
| 327 365 | 
             
              product "push-jobs-client" do
         | 
| @@ -329,6 +367,7 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 329 367 | 
             
                package_name do |v|
         | 
| 330 368 | 
             
                  v < version_for("1.3.0") ? "opscode-push-jobs-client" : "push-jobs-client"
         | 
| 331 369 | 
             
                end
         | 
| 370 | 
            +
                github_repo "chef/opscode-pushy-client"
         | 
| 332 371 | 
             
              end
         | 
| 333 372 |  | 
| 334 373 | 
             
              product "push-jobs-server" do
         | 
| @@ -336,6 +375,7 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 336 375 | 
             
                package_name "opscode-push-jobs-server"
         | 
| 337 376 | 
             
                ctl_command "opscode-push-jobs-server-ctl"
         | 
| 338 377 | 
             
                config_file "/etc/opscode-push-jobs-server/opscode-push-jobs-server.rb"
         | 
| 378 | 
            +
                github_repo "chef/opscode-pushy-server"
         | 
| 339 379 | 
             
              end
         | 
| 340 380 |  | 
| 341 381 | 
             
              product "reporting" do
         | 
| @@ -343,6 +383,7 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 343 383 | 
             
                package_name "opscode-reporting"
         | 
| 344 384 | 
             
                ctl_command "opscode-reporting-ctl"
         | 
| 345 385 | 
             
                config_file "/etc/opscode-reporting/opscode-reporting.rb"
         | 
| 386 | 
            +
                github_repo "chef/oc_reporting"
         | 
| 346 387 | 
             
              end
         | 
| 347 388 |  | 
| 348 389 | 
             
              product "supermarket" do
         | 
| @@ -357,5 +398,7 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do | |
| 357 398 | 
             
                package_name "chef-sync"
         | 
| 358 399 | 
             
                ctl_command "chef-sync-ctl"
         | 
| 359 400 | 
             
                config_file "/etc/chef-sync/chef-sync.rb"
         | 
| 401 | 
            +
                github_repo "chef/omnibus-sync"
         | 
| 402 | 
            +
                downloads_product_page_url :not_available
         | 
| 360 403 | 
             
              end
         | 
| 361 404 | 
             
            end
         | 
    
        data/mixlib-install.gemspec
    CHANGED
    
    | @@ -10,14 +10,13 @@ Gem::Specification.new do |spec| | |
| 10 10 | 
             
              spec.email         = ["thom@chef.io", "patrick@chef.io"]
         | 
| 11 11 | 
             
              spec.license       = "Apache-2.0"
         | 
| 12 12 |  | 
| 13 | 
            -
              spec.summary       = "A  | 
| 13 | 
            +
              spec.summary       = "A library for interacting with Chef Software Inc's software distribution systems."
         | 
| 14 14 | 
             
              spec.homepage      = "https://chef.io"
         | 
| 15 15 |  | 
| 16 16 | 
             
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         | 
| 17 17 | 
             
              spec.executables   = ["mixlib-install"]
         | 
| 18 18 | 
             
              spec.require_paths = ["lib"]
         | 
| 19 19 |  | 
| 20 | 
            -
              spec.add_dependency "artifactory"
         | 
| 21 20 | 
             
              spec.add_dependency "mixlib-shellout"
         | 
| 22 21 | 
             
              spec.add_dependency "mixlib-versioning"
         | 
| 23 22 | 
             
              spec.add_dependency "thor"
         | 
    
        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:  | 
| 4 | 
            +
              version: 3.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Thom May
         | 
| @@ -9,22 +9,8 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2017- | 
| 12 | 
            +
            date: 2017-03-09 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            -
              name: artifactory
         | 
| 16 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                requirements:
         | 
| 18 | 
            -
                - - ">="
         | 
| 19 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 20 | 
            -
                    version: '0'
         | 
| 21 | 
            -
              type: :runtime
         | 
| 22 | 
            -
              prerelease: false
         | 
| 23 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 24 | 
            -
                requirements:
         | 
| 25 | 
            -
                - - ">="
         | 
| 26 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 27 | 
            -
                    version: '0'
         | 
| 28 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 29 15 | 
             
              name: mixlib-shellout
         | 
| 30 16 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -309,8 +295,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 309 295 | 
             
                  version: '0'
         | 
| 310 296 | 
             
            requirements: []
         | 
| 311 297 | 
             
            rubyforge_project: 
         | 
| 312 | 
            -
            rubygems_version: 2.6. | 
| 298 | 
            +
            rubygems_version: 2.6.10
         | 
| 313 299 | 
             
            signing_key: 
         | 
| 314 300 | 
             
            specification_version: 4
         | 
| 315 | 
            -
            summary: A  | 
| 301 | 
            +
            summary: A library for interacting with Chef Software Inc's software distribution
         | 
| 302 | 
            +
              systems.
         | 
| 316 303 | 
             
            test_files: []
         |