Sha256: 32a62f46ddacaacd204f45386af60620a9c56e5a78bc38e4e1906321f6b06ff9

Contents?: true

Size: 808 Bytes

Versions: 6

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

6 entries across 6 versions & 1 rubygems

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