Class: VMCMicro::Switcher::Base
- Inherits:
-
Object
- Object
- VMCMicro::Switcher::Base
show all
- Defined in:
- lib/mcf-vmc-plugin/micro/switcher/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
6
7
8
9
10
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 6
def initialize(config)
@config = config
@vmrun = VMCMicro::VMrun.new(config)
end
|
Instance Method Details
#domain ⇒ Object
17
18
19
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 17
def domain
@vmrun.domain
end
|
#ip ⇒ Object
21
22
23
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 21
def ip
@vmrun.ip
end
|
#nat? ⇒ Boolean
41
42
43
44
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 41
def nat?
@config['online_connection_type'] ||= @vmrun.connection_type
@config["online_connection_type"] == "nat"
end
|
#offline! ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 63
def offline!
if @vmrun.offline?
raise VMCMicro::MCFError, "Micro Cloud Foundry VM already in offline mode"
else
@vmrun.offline!
end
end
|
#offline? ⇒ Boolean
37
38
39
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 37
def offline?
@vmrun.offline?
end
|
#online! ⇒ Object
71
72
73
74
75
76
77
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 71
def online!
if @vmrun.offline?
@vmrun.online!
else
raise VMCMirco::MCFError, "Micro Cloud Foundry already in online mode"
end
end
|
#ready? ⇒ Boolean
33
34
35
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 33
def ready?
@vmrun.ready?
end
|
#reset_to_nat! ⇒ Object
46
47
48
49
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 46
def reset_to_nat!
@vmrun.connection_type = 'nat'
@vmrun.reset
end
|
#running? ⇒ Boolean
25
26
27
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 25
def running?
@vmrun.running?
end
|
#set_host_dns! ⇒ Object
51
52
53
54
55
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 51
def set_host_dns!
@config['domain'] ||= @vmrun.domain
@config['ip'] ||= @vmrun.ip
set_nameserver(@config['domain'], @config['ip'])
end
|
#start! ⇒ Object
29
30
31
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 29
def start!
@vmrun.start!
end
|
#unset_host_dns! ⇒ Object
57
58
59
60
61
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 57
def unset_host_dns!
@config['domain'] ||= @vmrun.domain
@config['ip'] ||= @vmrun.ip
unset_nameserver(@config['domain'], @config['ip'])
end
|
#vmx ⇒ Object
13
14
15
|
# File 'lib/mcf-vmc-plugin/micro/switcher/base.rb', line 13
def vmx
@vmrun.vmx
end
|