Sha256: 5ffb56c3613fcfe669f1e5374f5412f3a10fb0c2bc45a4a8e1852f82bfa95256

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

require 'vagrant-openstack-provider/command/utils'
require 'vagrant-openstack-provider/command/abstract_command'

module VagrantPlugins
  module Openstack
    module Command
      class SubnetList < AbstractCommand
        include VagrantPlugins::Openstack::Command::Utils

        def self.synopsis
          I18n.t('vagrant_openstack.command.subnet_list_synopsis')
        end

        def cmd(name, argv, env)
          fail Errors::NoArgRequiredForCommand, cmd: name unless argv.size == 0
          rows = []
          env[:openstack_client].neutron.get_subnets(env).each do |subnet|
            rows << [subnet.id, subnet.name, subnet.cidr, subnet.enable_dhcp, subnet.network_id]
          end
          display_table(env, ['Id', 'Name', 'CIDR', 'DHCP', 'Network Id'], rows)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-openstack-provider-0.6.0 lib/vagrant-openstack-provider/command/subnet_list.rb