Class: Vagrant::Notify::Action::ServerIsRunning

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-notify/action/server_is_running.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ServerIsRunning

Returns a new instance of ServerIsRunning.



7
8
9
10
# File 'lib/vagrant-notify/action/server_is_running.rb', line 7

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant::notify::action::prepare_data_dir")
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vagrant-notify/action/server_is_running.rb', line 12

def call(env)
  env[:result] = valid_process?(env[:notify_data][:pid])

  unless env[:notify_data][:bind_ip]
    env[:notify_data][:bind_ip] = env[:machine].config.notify.bind_ip if env[:machine].config.notify.bind_ip.is_a?(String)
  end

  # Call the next if we have one (but we shouldn't, since this
  # middleware is built to run with the Call-type middlewares)
  @app.call env
end