[refs #430] Delete containers after deleting build list

This commit is contained in:
Vladimir Sharshov 2012-05-23 14:52:23 +04:00
parent ec711eff48
commit 70a89dccd0
1 changed files with 10 additions and 0 deletions

View File

@ -98,6 +98,7 @@ class BuildList < ActiveRecord::Base
before_create :set_default_status
after_create :place_build
after_destroy :delete_container
def self.human_status(status)
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
@ -192,6 +193,15 @@ class BuildList < ActiveRecord::Base
save
end
def delete_container
if can_cancel?
BuildServer.delete_build_list bs_id
else
BuildServer.delete_container bs_id if bs_id # prevent error if bs_id does not set
end
end
def build_package(pkg_hash, package_type, prj)
packages.create(pkg_hash) do |p|
p.project = prj