Sha256: 19c64c4539d56d7041032c2753b2638971f3616ad2628fc693e2960c07bbf4aa

Contents?: true

Size: 808 Bytes

Versions: 5

Compression:

Stored size: 808 Bytes

Contents

require 'vagrant-conoha/command/openstack_command'

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

        def cmd(name, argv, env)
          fail Errors::NoArgRequiredForCommand, cmd: name unless argv.size == 0
          volumes = env[:openstack_client].cinder.get_all_volumes(env)

          rows = []
          volumes.each do |v|
            attachment = "#{v.instance_id} (#{v.device})" unless v.instance_id.nil?
            rows << [v.id, v.name, v.size, v.status, attachment]
          end
          display_table(env, ['ID', 'Name', 'Size (Go)', 'Status', 'Attachment (instance ID and device)'], rows)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vagrant-conoha-0.1.10 lib/vagrant-conoha/command/volume_list.rb
vagrant-conoha-0.1.9 lib/vagrant-conoha/command/volume_list.rb
vagrant-conoha-0.1.8 lib/vagrant-conoha/command/volume_list.rb
vagrant-conoha-0.1.7 lib/vagrant-conoha/command/volume_list.rb
vagrant-conoha-0.1.6 lib/vagrant-conoha/command/volume_list.rb