From 2ac4391edfca488065f97baa057b47f247f00b00 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Thu, 22 Dec 2011 01:31:05 +0200 Subject: [PATCH] Redo build_list publish to check returned status. Refs #77 --- app/models/build_list.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 1c1562863..94522d13d 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -103,13 +103,12 @@ class BuildList < ActiveRecord::Base end end end - + def publish - return false unless can_publish? - - BuildServer.publish_container bs_id - self.update_attribute(:status, BUILD_PUBLISHED) - #self.destroy # self.delete + has_published = BuildServer.publish_container bs_id + update_attribute(:status, BUILD_PUBLISHED) if has_published == 0 + + return has_published == 0 end def can_publish? @@ -119,7 +118,7 @@ class BuildList < ActiveRecord::Base def cancel has_canceled = BuildServer.delete_build_list bs_id update_attribute(:status, BUILD_CANCELED) if has_canceled == 0 - + return has_canceled == 0 end