From: Jan Provaznik <jprovazn(a)redhat.com>
Build object is created in warehouse after build is finished,
so it's better to check for :building status first. Active_build
is now searched by image_id instead of build_id which can be not set.
---
src/app/models/deployable.rb | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/app/models/deployable.rb b/src/app/models/deployable.rb
index 538b6f6..9712008 100644
--- a/src/app/models/deployable.rb
+++ b/src/app/models/deployable.rb
@@ -151,12 +151,13 @@ class Deployable < ActiveRecord::Base
end
def image_status(image, account)
- build = image.latest_pushed_or_unpushed_build
target = account.provider.provider_type.deltacloud_driver
- return :not_built unless build
builder = Aeolus::Image::Factory::Builder.first
- return :building if builder.find_active_build(build.id, target)
+ return :building if builder.find_active_build_by_imageid(image.id, target)
+
+ build = image.latest_pushed_or_unpushed_build
+ return :not_built unless build
target_image = build.target_images.find { |ti| ti.target == target }
return :not_built unless target_image
--
1.7.7.5