Class: VagrantPlugins::Rackspace::Action::ListImages

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ListImages

Returns a new instance of ListImages.



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

def call(env)
  compute_service = env[:rackspace_compute]
  env[:ui].info ('%-36s %s' % ['Image ID', 'Image Name'])
  compute_service.images.sort_by(&:name).each do |image|
    env[:ui].info ('%-36s %s' % [image.id.to_s, image.name])
  end
  @app.call(env)
end