Class: VagrantRubydns::Action::Teardown
- Inherits:
-
Object
- Object
- VagrantRubydns::Action::Teardown
- Defined in:
- lib/vagrant-rubydns/action/teardown.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ Teardown
constructor
A new instance of Teardown.
- #stop_server_if_necessary(env) ⇒ Object
- #teardown_machine_dns(env) ⇒ Object
- #teardown_static_dns(env) ⇒ Object
Constructor Details
#initialize(app, env) ⇒ Teardown
Returns a new instance of Teardown.
4 5 6 |
# File 'lib/vagrant-rubydns/action/teardown.rb', line 4 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vagrant-rubydns/action/teardown.rb', line 8 def call(env) if env[:global_config].rubydns.enabled? teardown_static_dns(env) teardown_machine_dns(env) DependentVMs.remove(env[:machine]) stop_server_if_necessary(env) end @app.call(env) end |
#stop_server_if_necessary(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant-rubydns/action/teardown.rb', line 19 def stop_server_if_necessary(env) if Server.running? if DependentVMs.none? env[:ui].info "[rubydns] no dependent vms left, stopping dns server" Server.stop else env[:ui].info "[rubydns] there are dependent vms left, leaving dns server" end else env[:ui].info "[rubydns] dns server already stopped" end end |