#907: add action for removing archive after destroy tag
This commit is contained in:
parent
9b483d0ec2
commit
28d4f278b9
|
@ -216,9 +216,8 @@ class Project < ActiveRecord::Base
|
|||
system "curl --user #{token}: -POST -F 'file_store[file]=@#{archive[:path]};filename=#{name}-#{tag.name}.#{tag_file_format(format)}' #{APP_CONFIG['file_store_url']}/api/v1/upload"
|
||||
end
|
||||
if project_tag
|
||||
old_sha1 = project_tag.sha1
|
||||
project_tag.remove_archive_from_file_store(project_tag.sha1)
|
||||
project_tag.update_attributes(:sha1 => sha1)
|
||||
system "curl --user #{token}: -X DELETE #{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{old_sha1}.json"
|
||||
else
|
||||
project_tags.create(
|
||||
:tag_name => tag.name,
|
||||
|
|
|
@ -16,4 +16,12 @@ class ProjectTag < ActiveRecord::Base
|
|||
:tag_name,
|
||||
:format_id
|
||||
|
||||
after_destroy :remove_archive_from_file_store
|
||||
|
||||
def remove_archive_from_file_store(sha = sha1)
|
||||
token = User.find_by_uname('rosa_system').authentication_token
|
||||
system "curl --user #{token}: -X DELETE #{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha}.json"
|
||||
end
|
||||
later :remove_archive_from_file_store, :queue => :clone_build
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue