Class: VagrantPlugins::Scaleway::Action::ListBootscripts

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-scaleway/action/list_bootscripts.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ ListBootscripts

Returns a new instance of ListBootscripts.



5
6
7
# File 'lib/vagrant-scaleway/action/list_bootscripts.rb', line 5

def initialize(app, _env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/vagrant-scaleway/action/list_bootscripts.rb', line 9

def call(env)
  compute = env[:scaleway_compute]

  env[:ui].info(format('%-37s %-7s %s', 'Bootscript ID', 'Arch', 'Bootscript Title'), prefix: false)
  compute.bootscripts.sort_by(&:title).each do |bootscript|
    env[:ui].info(format('%-37s %-7s %s', bootscript.id, bootscript.architecture, bootscript.title), prefix: false)
  end

  @app.call(env)
end