Sha256: 69d3456efe1a3b76c08d9f33e96f1c347e6d921a5a9f11745cc211c7e5cbdb58

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

require 'vagrant-openstack-provider/command/openstack_command'

module VagrantPlugins
  module Openstack
    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

9 entries across 9 versions & 2 rubygems

Version Path
vagrant-openstack-provider-0.13.0 lib/vagrant-openstack-provider/command/image_list.rb
vagrant-openstack-provider-0.12.0 lib/vagrant-openstack-provider/command/image_list.rb
vagrant-openstack-provider-illuin-0.11.1 lib/vagrant-openstack-provider/command/image_list.rb
vagrant-openstack-provider-0.11.0 lib/vagrant-openstack-provider/command/image_list.rb
vagrant-openstack-provider-0.10.0 lib/vagrant-openstack-provider/command/image_list.rb
vagrant-openstack-provider-0.9.0 lib/vagrant-openstack-provider/command/image_list.rb
vagrant-openstack-provider-0.8.0 lib/vagrant-openstack-provider/command/image_list.rb
vagrant-openstack-provider-0.7.2 lib/vagrant-openstack-provider/command/image_list.rb
vagrant-openstack-provider-0.7.1 lib/vagrant-openstack-provider/command/image_list.rb