Class: VagrantPlugins::DNS::Action::StartDNSServer

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-dns/action/start_dns_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ StartDNSServer

Returns a new instance of StartDNSServer.



7
8
9
# File 'lib/vagrant-dns/action/start_dns_server.rb', line 7

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

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/vagrant-dns/action/start_dns_server.rb', line 11

def call(env)
  unless env[:machine].config.dns.enabled
    return @app.call(env)
  end

  env[:dns].ui.info "Restarting dns server..."
  env[:dns].dns_server.restart!

  @app.call(env)
end