2013-06-26 05:00:13 +00:00
|
|
|
class ArtifactsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
respond_to :json
|
|
|
|
|
|
|
|
|
|
# create or update a client_artifact row
|
|
|
|
|
def update_artifacts
|
|
|
|
|
|
|
|
|
|
product = params[:product]
|
|
|
|
|
version = params[:version]
|
|
|
|
|
uri = params[:uri]
|
|
|
|
|
file = params[:file]
|
|
|
|
|
environment = params[:environment]
|
|
|
|
|
|
2014-02-04 17:05:38 +00:00
|
|
|
ArtifactUpdate.transaction do
|
|
|
|
|
# VRFS-1071: Postpone client update notification until installer is available for download
|
|
|
|
|
ArtifactUpdate.connection.execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED')
|
2016-08-31 09:19:16 +00:00
|
|
|
@artifact = ArtifactUpdate.find_or_create_by({product: product, environment: environment})
|
2013-06-26 05:00:13 +00:00
|
|
|
|
2014-02-04 17:05:38 +00:00
|
|
|
@artifact.version = version
|
|
|
|
|
@artifact.uri = file
|
2013-06-26 05:00:13 +00:00
|
|
|
|
2014-02-04 17:05:38 +00:00
|
|
|
@artifact.save
|
2014-08-31 15:30:59 +00:00
|
|
|
|
|
|
|
|
if @artifact.save
|
|
|
|
|
@artifact.send_notice
|
|
|
|
|
end
|
2014-02-04 17:05:38 +00:00
|
|
|
end
|
2013-06-26 05:00:13 +00:00
|
|
|
|
2020-06-05 22:56:17 +00:00
|
|
|
unless @artifact.errors.any?
|
|
|
|
|
render :json => {}, :status => :ok
|
|
|
|
|
else
|
|
|
|
|
response.status = :unprocessable_entity
|
|
|
|
|
respond_with @artifact
|
|
|
|
|
end
|
2013-06-26 05:00:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|