Class: VagrantPlugins::Openstack::Command::ImageList
- Inherits:
-
OpenstackCommand
- Object
- AbstractCommand
- OpenstackCommand
- VagrantPlugins::Openstack::Command::ImageList
- Defined in:
- lib/vagrant-openstack-illuin-provider/command/image_list.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from OpenstackCommand
Methods included from Utils
#display_item_list, #display_table
Methods inherited from AbstractCommand
#before_cmd, #execute, #initialize, #normalize_args
Constructor Details
This class inherits a constructor from VagrantPlugins::Openstack::Command::AbstractCommand
Class Method Details
.synopsis ⇒ Object
7 8 9 |
# File 'lib/vagrant-openstack-illuin-provider/command/image_list.rb', line 7 def self.synopsis I18n.t('vagrant_openstack.command.image_list_synopsis') end |
Instance Method Details
#cmd(name, argv, env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/vagrant-openstack-illuin-provider/command/image_list.rb', line 11 def cmd(name, argv, env) fail Errors::NoArgRequiredForCommand, cmd: name unless argv.size == 0 rows = [] headers = %w(ID Name) if env[:openstack_client].session.endpoints.key? :image images = env[:openstack_client].glance.get_all_images(env) images.each { |i| rows << [i.id, i.name, i.visibility, i.size.to_i / 1024 / 1024, i.min_ram, i.min_disk] } headers << ['Visibility', 'Size (Mo)', 'Min RAM (Go)', 'Min Disk (Go)'] headers = headers.flatten else images = env[:openstack_client].nova.get_all_images(env) images.each { |image| rows << [image.id, image.name] } end display_table(env, headers, rows) end |