Class: ComputeImages
- Inherits:
-
Object
- Object
- ComputeImages
- Defined in:
- lib/danarchy_sys/openstack/compute/images.rb
Overview
OpenStack Image Management
Instance Method Summary collapse
- #all_images ⇒ Object
- #get_image_by_id(image_id) ⇒ Object
- #get_image_by_name(image_name) ⇒ Object
-
#initialize(compute) ⇒ ComputeImages
constructor
A new instance of ComputeImages.
- #list_images ⇒ Object
Constructor Details
#initialize(compute) ⇒ ComputeImages
Returns a new instance of ComputeImages.
4 5 6 |
# File 'lib/danarchy_sys/openstack/compute/images.rb', line 4 def initialize(compute) @compute = compute end |
Instance Method Details
#all_images ⇒ Object
8 9 10 |
# File 'lib/danarchy_sys/openstack/compute/images.rb', line 8 def all_images @compute.images end |
#get_image_by_id(image_id) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/danarchy_sys/openstack/compute/images.rb', line 39 def get_image_by_id(image_id) images = all_images # Get image based on input image_id. image = 'nil' images.each do |i| next unless i.id == image_id next unless i.status == 'ACTIVE' image = i end image end |
#get_image_by_name(image_name) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/danarchy_sys/openstack/compute/images.rb', line 25 def get_image_by_name(image_name) images = all_images # Get image based on input image_name. image = 'nil' images.each do |i| next unless i.name == image_name next unless i.status == 'ACTIVE' image = i end image end |
#list_images ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/danarchy_sys/openstack/compute/images.rb', line 12 def list_images images = all_images image_list = [] # Get image names into array images.each do |i| next unless i.status == 'ACTIVE' image_list.push(i.name) end image_list end |