Class: Aeolus::Image::Warehouse::ImageBuild

Inherits:
WarehouseModel show all
Defined in:
lib/aeolus_image/model/warehouse/image_build.rb

Instance Attribute Summary

Attributes inherited from WarehouseModel

#body

Instance Method Summary collapse

Methods inherited from WarehouseModel

#==, all, #bucket_object, bucket_objects, config, config=, create!, delete, find, first, #id, #initialize, iwhd_url, last, oauth_consumer_key, oauth_consumer_secret, #set_attr, set_warehouse_and_bucket, use_oauth?, where

Constructor Details

This class inherits a constructor from Aeolus::Image::Warehouse::WarehouseModel

Instance Method Details

#delete!Object

Deletes this image and all child objects



48
49
50
51
52
53
54
55
56
# File 'lib/aeolus_image/model/warehouse/image_build.rb', line 48

def delete!
  begin
    target_images.each do |ti|
      ti.delete!
    end
  rescue NoMethodError
  end
  ImageBuild.delete(@uuid)
end

#imageObject



21
22
23
# File 'lib/aeolus_image/model/warehouse/image_build.rb', line 21

def image
  Image.find(@image) if @image
end

#provider_imagesObject

Convenience Method to get all provider images for this build



30
31
32
33
34
35
36
# File 'lib/aeolus_image/model/warehouse/image_build.rb', line 30

def provider_images
  provider_images = []
  target_images.each do |t|
    provider_images = provider_images + t.provider_images
  end
  provider_images
end

#provider_images_by_provider_and_account(provider, provider_account) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/aeolus_image/model/warehouse/image_build.rb', line 37

def (provider, )
  provider_images = []
  target_images.each do |t|
    provider_images = provider_images +
      t.(provider,
                                                    )
  end
  provider_images
end

#target_imagesObject



25
26
27
# File 'lib/aeolus_image/model/warehouse/image_build.rb', line 25

def target_images
  TargetImage.where("($build == \"" + @uuid.to_s + "\")")
end