From 166647d1127e9f77a359b99d8bc9ae2b464231ce Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 12 May 2016 18:54:00 -0500 Subject: [PATCH] VRFS-4074 - cloud uri/storage for jamblaster --- ruby/lib/jam_ruby/models/artifact_update.rb | 2 +- web/app/controllers/artifacts_controller.rb | 11 ++++++++++- web/config/routes.rb | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ruby/lib/jam_ruby/models/artifact_update.rb b/ruby/lib/jam_ruby/models/artifact_update.rb index 9b671df91..080310564 100644 --- a/ruby/lib/jam_ruby/models/artifact_update.rb +++ b/ruby/lib/jam_ruby/models/artifact_update.rb @@ -4,7 +4,7 @@ module JamRuby DEFAULT_ENVIRONMENT = 'public' CLIENT_PREFIX = 'JamClient' - PRODUCTS = ["#{CLIENT_PREFIX}/Win32", "#{CLIENT_PREFIX}/MacOSX"] + PRODUCTS = ["#{CLIENT_PREFIX}/Win32", "#{CLIENT_PREFIX}/MacOSX", "#{CLIENT_PREFIX}/JamBlaster"] self.primary_key = 'id' attr_accessible :version, :uri, :sha1, :environment, :product, as: :admin diff --git a/web/app/controllers/artifacts_controller.rb b/web/app/controllers/artifacts_controller.rb index 54628b22c..b35cf9c61 100644 --- a/web/app/controllers/artifacts_controller.rb +++ b/web/app/controllers/artifacts_controller.rb @@ -6,15 +6,24 @@ class ArtifactsController < ApiController def client_downloads clients = ArtifactUpdate.where("product like '%JamClient%' and environment = '#{ArtifactUpdate::DEFAULT_ENVIRONMENT}'").order(:product) + if params[:type] + cliens = clients.where("product ilike 'JamClient/#{params[:type]}'") + end + result = {} clients.each do |client| url = client.determine_url - result[client.product] = { :uri => url, :size => client.size } + if params[:type] + result[params[:type]] = { :uri => url, :size => client.size, :version => client.version, :md5 => client.sha1} + else + result[client.product] = { :uri => url, :size => client.size, :version => client.version, :md5 => client.sha1} + end end render :json => result, :status => :ok end + def healthcheck render :json => {} end diff --git a/web/config/routes.rb b/web/config/routes.rb index ce91aecbe..ceac86c98 100644 --- a/web/config/routes.rb +++ b/web/config/routes.rb @@ -633,6 +633,7 @@ SampleApp::Application.routes.draw do # list all uris for available clients on mac, windows, linux, if available match '/artifacts/clients' => 'artifacts#client_downloads' + match '/artifacts/:type' => 'artifacts#client_downloads' # crash logs match '/crashes' => 'api_users#crash_dump', :via => :put