Class: VagrantPlugins::Rackspace::Action::ListNetworks
- Inherits:
-
Object
- Object
- VagrantPlugins::Rackspace::Action::ListNetworks
- Defined in:
- lib/vagrant-rackspace/action/list_networks.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ListNetworks
constructor
A new instance of ListNetworks.
Constructor Details
#initialize(app, env) ⇒ ListNetworks
Returns a new instance of ListNetworks.
5 6 7 |
# File 'lib/vagrant-rackspace/action/list_networks.rb', line 5 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/vagrant-rackspace/action/list_networks.rb', line 9 def call(env) compute_service = env[:rackspace_compute] env[:ui].info ('%-36s %-24s %s' % ['Network Name', 'Network CIDR', 'Network ID']) compute_service.networks.sort_by(&:label).each do |network| env[:ui].info ('%-36s %-24s %s' % [network.label, network.cidr, network.id]) end @app.call(env) end |