Sha256: 8da29a36ba77621b508463484d384d75ff826391c2b237bf182d98af5395bac6
Contents?: true
Size: 1.02 KB
Versions: 5
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
5 entries across 5 versions & 1 rubygems