[refs #430] Delete containers after deleting build list
This commit is contained in:
parent
ec711eff48
commit
70a89dccd0
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue