Merge pull request #498 from warpc/430-delete_old_bs

[refs #430] Delete containers after deleting build list
This commit is contained in:
santaux 2012-05-23 03:58:40 -07:00
commit bfdf81c377
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