Class: VagrantPlugins::DNS::Action::StopDNSServer

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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ StopDNSServer

Returns a new instance of StopDNSServer.



7
8
9
# File 'lib/vagrant-dns/action/stop_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/stop_dns_server.rb', line 11

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

  env[:dns].ui.info "Stopping dns server..."
  env[:dns].dns_server.stop!

  @app.call(env)
end