cookbooks/chef-ingredient/libraries/helpers.rb
# Version has a default value of 0.0.0 so that it is a valid
# string for the Mixlib::Versioning.parse method. This implies
# "latest", but "latest" is not a value that is valid for
# mixlib/versioning.
Version has a default value of 0.0.0 so that it is a valid
string for the Mixlib::Versioning.parse method. This implies
"latest", but "latest" is not a value that is valid for
mixlib/versioning.
Version has a default value of 0 . 0 . 0 so that it is a valid string for the Mixlib :: Versioning . parse method . This implies " latest " but " latest " is not a value that is valid for mixlib / versioning .
def product_lookup(product, version = '0.0.0')
      unless product_matrix.key?(product)
        Chef::Log.fatal("We don't have a product, '#{product}'. Please specify a valid product name:")
        Chef::Log.fatal(product_matrix.keys.join(' '))
        fail
      end
      require 'mixlib/versioning'
      v = Mixlib::Versioning.parse(version_string(version))
      data = product_matrix[product]
      if (product == 'chef-server')
        if (v < Mixlib::Versioning.parse('12.0.0')) && (v > Mixlib::Versioning.parse('11.0.0'))
          data['package-name'] = 'chef-server'
        elsif (v < Mixlib::Versioning.parse('11.0.0')) && (v > Mixlib::Versioning.parse('1.0.0'))
          Chef::Log.fatal("Invalid version specified, '#{version}' for #{product}!")
          fail
        end
      elsif (product == 'manage') && (v < Mixlib::Versioning.parse('2.0.0'))
        data['package-name'] = 'opscode-manage'
        data['ctl-command'] = 'opscode-manage-ctl'
      elsif (product == 'push-server') && (v < Mixlib::Versioning.parse('2.0.0'))
        data['package-name'] = 'opscode-push-jobs-server'
        data['ctl-command'] = 'opscode-push-jobs-server-ctl'
      elsif (product == 'push-client') && (v < Mixlib::Versioning.parse('2.0.0'))
        data['package-name'] = 'opscode-push-jobs-client'
      end
      data
    end
def product_lookup ( product , version = '0.0.0' ) unless product_matrix . key? ( product ) Chef :: Log . fatal ( "We don't have a product, '#{product}'. Please specify a valid product name:" ) Chef :: Log . fatal ( product_matrix . keys . join ( ' ' ) ) fail end require 'mixlib/versioning' v = Mixlib :: Versioning . parse ( version_string ( version ) ) data = product_matrix [ product ] if ( product == 'chef-server' ) if ( v < Mixlib :: Versioning . parse ( '12.0.0' ) ) && ( v > Mixlib :: Versioning . parse ( '11.0.0' ) ) data [ 'package-name' ] = 'chef-server' elsif ( v < Mixlib :: Versioning . parse ( '11.0.0' ) ) && ( v > Mixlib :: Versioning . parse ( '1.0.0' ) ) Chef :: Log . fatal ( "Invalid version specified, '#{version}' for #{product}!" ) fail end elsif ( product == 'manage' ) && ( v < Mixlib :: Versioning . parse ( '2.0.0' ) ) data [ 'package-name' ] = 'opscode-manage' data [ 'ctl-command' ] = 'opscode-manage-ctl' elsif ( product == 'push-server' ) && ( v < Mixlib :: Versioning . parse ( '2.0.0' ) ) data [ 'package-name' ] = 'opscode-push-jobs-server' data [ 'ctl-command' ] = 'opscode-push-jobs-server-ctl' elsif ( product == 'push-client' ) && ( v < Mixlib :: Versioning . parse ( '2.0.0' ) ) data [ 'package-name' ] = 'opscode-push-jobs-client' end data end
Version has a default value of 0.0.0 so that it is a valid
string for the Mixlib::Versioning.parse method.
Version has a default value of 0 . 0 . 0 so that it is a valid string for the Mixlib :: Versioning . parse method .
# We want to validate that we're getting a version that is valid # for the Chef Server. However, since the default is 0.0.0, # implying latest, we need to additionally ensure that the # bottom version is something valid. If we don't have the check # in the elsif, it will say that 0.0.0 is not a valid version. # TODO: When Chef Push server and client 2.0 are released, we # need to implement similar logic to chef-server, so that the # default "latest" version, 0.0.0 (no constraint) doesn't result # in the old package.
product
version