Class: VagrantPlugins::Rackspace::Action::ListServers
- Inherits:
-
Object
- Object
- VagrantPlugins::Rackspace::Action::ListServers
- Defined in:
- lib/vagrant-rackspace/action/list_servers.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ ListServers
constructor
A new instance of ListServers.
Constructor Details
#initialize(app, env) ⇒ ListServers
Returns a new instance of ListServers.
5 6 7 |
# File 'lib/vagrant-rackspace/action/list_servers.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_servers.rb', line 9 def call(env) compute_service = env[:rackspace_compute] env[:ui].info ('%-20s %-20s %s' % ['Server Name', 'State', 'IPv4 address']) compute_service.servers.sort_by(&:name).each do |server| env[:ui].info ('%-20s %-20s %s' % [server.name, server.state, server.access_ipv4_address]) end @app.call(env) end |