Class: Aeolus::Image::Warehouse::TargetImage
- Inherits:
-
WarehouseModel
- Object
- WarehouseModel
- Aeolus::Image::Warehouse::TargetImage
- Defined in:
- lib/aeolus_image/model/warehouse/target_image.rb
Instance Attribute Summary
Attributes inherited from WarehouseModel
Instance Method Summary collapse
- #build ⇒ Object
-
#delete! ⇒ Object
Deletes this targetimage and all child objects.
- #find_provider_image_by_provider_and_account(provider, provider_account) ⇒ Object
- #provider_images ⇒ Object
- #target_template ⇒ Object
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
#build ⇒ Object
21 22 23 |
# File 'lib/aeolus_image/model/warehouse/target_image.rb', line 21 def build ImageBuild.find(@build) if @build end |
#delete! ⇒ Object
Deletes this targetimage and all child objects
34 35 36 37 38 39 40 41 42 |
# File 'lib/aeolus_image/model/warehouse/target_image.rb', line 34 def delete! begin provider_images.each do |pi| pi.delete! end rescue NoMethodError end TargetImage.delete(@uuid) end |
#find_provider_image_by_provider_and_account(provider, provider_account) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/aeolus_image/model/warehouse/target_image.rb', line 44 def find_provider_image_by_provider_and_account(provider, provider_account) conditions = ["$target_image == \"#{@uuid}\""] conditions << "$provider == \"#{provider}\"" if provider conditions << "$provider_account_identifier == \"#{provider_account}\"" if provider_account ProviderImage.where('(' + conditions.join(' && ') + ')') end |
#provider_images ⇒ Object
25 26 27 |
# File 'lib/aeolus_image/model/warehouse/target_image.rb', line 25 def provider_images ProviderImage.where("($target_image == \"" + @uuid.to_s + "\")") end |