Class: VagrantPlugins::Vultr::Action::Reload

Inherits:
Object
  • Object
show all
Includes:
Helpers::Client
Defined in:
lib/vagrant-vultr/action/reload.rb

Instance Method Summary collapse

Methods included from Helpers::Client

#client

Constructor Details

#initialize(app, env) ⇒ Reload

Returns a new instance of Reload.



9
10
11
12
13
14
# File 'lib/vagrant-vultr/action/reload.rb', line 9

def initialize(app, env)
  @app = app
  @machine = env[:machine]
  @client = client
  @logger = Log4r::Logger.new('vagrant::vultr::reload')
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vagrant-vultr/action/reload.rb', line 16

def call(env)
  @client.reboot_server(@machine.id)
  env[:ui].info 'Machine is stopped.'

  env[:ui].info 'Waiting for server to start...'
  @client.wait_to_power_on(@machine.id)
  env[:ui].info 'Waiting for SSH to become active...'
  @client.wait_for_ssh(@machine)

  env[:ui].info 'Machine is booted and ready to use!'

  @app.call(env)
end