lib/mixlib/install/backend/artifactory.rb in mixlib-install-1.0.7 vs lib/mixlib/install/backend/artifactory.rb in mixlib-install-1.0.8

- old
+ new

@@ -19,10 +19,11 @@ require "net/http" require "json" require "mixlib/install/artifact_info" require "artifactory" require "mixlib/install/backend/base" +require "mixlib/install/product" module Mixlib class Install class Backend class Artifactory < Base @@ -68,11 +69,11 @@ # @return [Array<ArtifactInfo>] Array of info about found artifacts def artifactory_latest # Get the list of builds from the REST api. # We do this because a user in the readers group does not have # permissions to run aql against builds. - builds = client.get("/api/build/#{options.product_name}") + builds = client.get("/api/build/#{package_name}") if builds.nil? raise NoArtifactsError, <<-MSG Can not find any builds for #{options.product_name} in #{::Artifactory.endpoint}. MSG @@ -110,11 +111,11 @@ # @return [Array<ArtifactInfo>] Array of info about found artifacts def artifactory_artifacts(version) results = artifactory_query(<<-QUERY items.find( {"repo": "omnibus-#{options.channel}-local"}, - {"@omnibus.project": "#{options.product_name}"}, + {"@omnibus.project": "#{package_name}"}, {"@omnibus.version": "#{version}"}, {"name": {"$nmatch": "*.metadata.json" }} ).include("repo", "path", "name", "property") QUERY ) @@ -204,9 +205,13 @@ raise e end end results + end + + def package_name + @package_name ||= PRODUCT_MATRIX.lookup(options.product_name, options.product_version).package_name end end end end end