Class: Landrush::Action::Teardown
- Inherits:
-
Object
- Object
- Landrush::Action::Teardown
show all
- Includes:
- Common
- Defined in:
- lib/landrush/action/teardown.rb
Constant Summary
Constants included
from Common
Common::SUPPORTED_PROVIDERS
Instance Method Summary
collapse
Methods included from Common
#config, #enabled?, #guest_redirect_dns?, #handle_action_stack, included, #info, #initialize, #libvirt?, #log, #machine, #machine_hostname, #parallels?, #provider, #read_machine_hostname, #virtualbox?, #vmware?
Instance Method Details
#call(env) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/landrush/action/teardown.rb', line 6
def call(env)
Server.working_dir = File.join(env[:home_path], 'data', 'landrush')
handle_action_stack(env) do
teardown if enabled?
end
end
|
#teardown ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/landrush/action/teardown.rb', line 16
def teardown
teardown_machine_dns
DependentVMs.remove(machine_hostname)
if DependentVMs.none?
teardown_static_dns
teardown_server
end
end
|
#teardown_machine_dns ⇒ Object
26
27
28
29
30
31
|
# File 'lib/landrush/action/teardown.rb', line 26
def teardown_machine_dns
if Store.hosts.has? machine_hostname
info "removing machine entry: #{machine_hostname}"
Store.hosts.delete(machine_hostname)
end
end
|
#teardown_server ⇒ Object
42
43
44
|
# File 'lib/landrush/action/teardown.rb', line 42
def teardown_server
Server.stop
end
|
#teardown_static_dns ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/landrush/action/teardown.rb', line 33
def teardown_static_dns
config.hosts.each do |static_hostname|
if Store.hosts.has? static_hostname
info "removing static entry: #{static_hostname}"
Store.hosts.delete static_hostname
end
end
end
|