Class: VagrantPlugins::Rackspace::Action::ListKeyPairs

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-rackspace/action/list_keypairs.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ListKeyPairs

Returns a new instance of ListKeyPairs.



5
6
7
# File 'lib/vagrant-rackspace/action/list_keypairs.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_keypairs.rb', line 9

def call(env)
  compute_service = env[:rackspace_compute]
  env[:ui].info ('%s' % ['KeyPair Name'])
  compute_service.key_pairs.sort_by(&:name).each do |keypair|
    env[:ui].info ('%s' % [keypair.name])
  end
  @app.call(env)
end