Module: VagrantPlugins::VCenter::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vagrant-vcenter/action.rb,
lib/vagrant-vcenter/action/resume.rb,
lib/vagrant-vcenter/action/destroy.rb,
lib/vagrant-vcenter/action/suspend.rb,
lib/vagrant-vcenter/action/build_vm.rb,
lib/vagrant-vcenter/action/power_on.rb,
lib/vagrant-vcenter/action/is_paused.rb,
lib/vagrant-vcenter/action/power_off.rb,
lib/vagrant-vcenter/action/is_created.rb,
lib/vagrant-vcenter/action/is_running.rb,
lib/vagrant-vcenter/action/read_state.rb,
lib/vagrant-vcenter/action/read_ssh_info.rb,
lib/vagrant-vcenter/action/connect_vcenter.rb,
lib/vagrant-vcenter/action/inventory_check.rb,
lib/vagrant-vcenter/action/announce_ssh_exec.rb,
lib/vagrant-vcenter/action/disconnect_vcenter.rb,
lib/vagrant-vcenter/action/message_not_created.rb,
lib/vagrant-vcenter/action/message_cannot_suspend.rb,
lib/vagrant-vcenter/action/message_already_running.rb,
lib/vagrant-vcenter/action/message_will_not_destroy.rb
Overview
Actions to be performed by the vagrant-vcenter provider.
Defined Under Namespace
Classes: AnnounceSSHExec, BuildVM, ConnectvCenter, Destroy, DisconnectvCenter, InventoryCheck, IsCreated, IsPaused, IsRunning, MessageAlreadyRunning, MessageCannotSuspend, MessageNotCreated, MessageWillNotDestroy, PowerOff, PowerOn, ReadSSHInfo, ReadState, Resume, Suspend
Class Method Summary
collapse
Class Method Details
.action_boot ⇒ Object
Vagrant commands This action boots the VM, assuming the VM is in a state that requires a bootup (i.e. not saved).
13
14
15
16
17
18
19
|
# File 'lib/vagrant-vcenter/action.rb', line 13
def self.action_boot
Vagrant::Action::Builder.new.tap do |b|
b.use PowerOn
b.use Provision
b.use SyncedFolders
end
end
|
.action_destroy ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/vagrant-vcenter/action.rb', line 90
def self.action_destroy
Vagrant::Action::Builder.new.tap do |b|
b.use Call, DestroyConfirm do |env, b2|
if env[:result]
b2.use ConfigValidate
b2.use ConnectvCenter
b2.use Call, IsRunning do |env2, b3|
b3.use action_halt if env2[:result]
b3.use Destroy
end
else
b2.use MessageWillNotDestroy
end
end
end
end
|
.action_halt ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'lib/vagrant-vcenter/action.rb', line 59
def self.action_halt
Vagrant::Action::Builder.new.tap do |b|
b.use ConnectvCenter
b.use Call, IsPaused do |env, b2|
b2.use Resume if env[:result]
b2.use PowerOff
end
end
end
|
.action_provision ⇒ Object
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/vagrant-vcenter/action.rb', line 108
def self.action_provision
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use Provision
b2.use SyncedFolders
end
end
end
|
.action_read_ssh_info ⇒ Object
This action is called to read the SSH info of the machine. The resulting state is expected to be put into the ‘:machine_ssh_info` key.
125
126
127
128
129
130
131
|
# File 'lib/vagrant-vcenter/action.rb', line 125
def self.action_read_ssh_info
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectvCenter
b.use ReadSSHInfo
end
end
|
.action_read_state ⇒ Object
This action is called to read the state of the machine. The resulting state is expected to be put into the ‘:machine_state_id` key.
136
137
138
139
140
141
142
|
# File 'lib/vagrant-vcenter/action.rb', line 136
def self.action_read_state
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectvCenter
b.use ReadState
end
end
|
.action_reload ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/vagrant-vcenter/action.rb', line 21
def self.action_reload
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use action_halt
b2.use action_start
b2.use DisconnectvCenter
end
end
end
|
.action_resume ⇒ Object
83
84
85
86
87
88
|
# File 'lib/vagrant-vcenter/action.rb', line 83
def self.action_resume
Vagrant::Action::Builder.new.tap do |b|
b.use ConnectvCenter
b.use Resume
end
end
|
.action_ssh ⇒ Object
144
145
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/vagrant-vcenter/action.rb', line 144
def self.action_ssh
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use AnnounceSSHExec
end
end
end
|
.action_ssh_run ⇒ Object
157
158
159
160
161
162
163
164
165
166
167
168
|
# File 'lib/vagrant-vcenter/action.rb', line 157
def self.action_ssh_run
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use SSHRun
end
end
end
|
.action_start ⇒ Object
This action starts a VM, assuming it is already imported and exists. A precondition of this action is that the VM exists.
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/vagrant-vcenter/action.rb', line 38
def self.action_start
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectvCenter
b.use Call, IsRunning do |env, b2|
if env[:result]
b2.use MessageAlreadyRunning
next
end
b2.use Call, IsPaused do |env2, b3|
if env2[:result]
b3.use Resume
next
end
b3.use action_boot
end
end
end
end
|
.action_suspend ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/vagrant-vcenter/action.rb', line 69
def self.action_suspend
Vagrant::Action::Builder.new.tap do |b|
b.use ConnectvCenter
b.use Call, IsRunning do |env, b2|
if !env[:result]
b2.use MessageCannotSuspend
else
b2.use Suspend
end
end
end
end
|
.action_up ⇒ Object
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/vagrant-vcenter/action.rb', line 170
def self.action_up
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsCreated do |env, b2|
b2.use HandleBox unless env[:result]
end
b.use ConnectvCenter
b.use InventoryCheck
b.use Call, IsCreated do |env, b2|
b2.use BuildVM unless env[:result]
end
b.use action_start
end
end
|