Sha256: 7eed9fb3986e8449c079d19df92c65f7f6b405dc4bf68e95c2a2fab0942b88fd

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

require 'vagrant-conoha/command/openstack_command'

module VagrantPlugins
  module ConoHa
    module Command
      class ImageList < OpenstackCommand
        def self.synopsis
          I18n.t('vagrant_openstack.command.image_list_synopsis')
        end

        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
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-conoha-0.1.5 lib/vagrant-conoha/command/image_list.rb
vagrant-conoha-0.1.4 lib/vagrant-conoha/command/image_list.rb
vagrant-conoha-0.1.3 lib/vagrant-conoha/command/image_list.rb
vagrant-conoha-0.1.2 lib/vagrant-conoha/command/image_list.rb
vagrant-conoha-0.1.1 lib/vagrant-conoha/command/image_list.rb
vagrant-conoha-0.1.0 lib/vagrant-conoha/command/image_list.rb