Module: VagrantPlugins::VSphere::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/vSphere/action.rb,
lib/vSphere/action/clone.rb,
lib/vSphere/action/resume.rb,
lib/vSphere/action/destroy.rb,
lib/vSphere/action/suspend.rb,
lib/vSphere/action/power_on.rb,
lib/vSphere/action/get_state.rb,
lib/vSphere/action/power_off.rb,
lib/vSphere/action/is_created.rb,
lib/vSphere/action/is_running.rb,
lib/vSphere/action/get_ssh_info.rb,
lib/vSphere/action/is_suspended.rb,
lib/vSphere/action/close_vsphere.rb,
lib/vSphere/action/snapshot_list.rb,
lib/vSphere/action/snapshot_save.rb,
lib/vSphere/action/connect_vsphere.rb,
lib/vSphere/action/snapshot_delete.rb,
lib/vSphere/action/snapshot_restore.rb,
lib/vSphere/action/message_not_created.rb,
lib/vSphere/action/message_not_running.rb,
lib/vSphere/action/wait_for_ip_address.rb,
lib/vSphere/action/message_not_suspended.rb,
lib/vSphere/action/message_already_created.rb
Defined Under Namespace
Classes: Clone, CloseVSphere, ConnectVSphere, Destroy, GetSshInfo, GetState, IsCreated, IsRunning, IsSuspended, MessageAlreadyCreated, MessageNotCreated, MessageNotRunning, MessageNotSuspended, PowerOff, PowerOn, Resume, SnapshotDelete, SnapshotList, SnapshotRestore, SnapshotSave, Suspend, WaitForIPAddress
Class Method Summary
collapse
Class Method Details
.action_destroy ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/vSphere/action.rb', line 12
def self.action_destroy
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use(ProvisionerCleanup, :before)
b.use Call, IsRunning do |env, b2|
if env[:result]
if env[:force_confirm_destroy]
b2.use PowerOff
next
end
b2.use Call, GracefulHalt, :poweroff, :running do |env2, b3|
b3.use PowerOff unless env2[:result]
end
end
end
b.use Destroy
end
end
|
.action_get_ssh_info ⇒ Object
219
220
221
222
223
224
225
226
|
# File 'lib/vSphere/action.rb', line 219
def self.action_get_ssh_info
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use GetSshInfo
b.use CloseVSphere
end
end
|
.action_get_state ⇒ Object
209
210
211
212
213
214
215
216
217
|
# File 'lib/vSphere/action.rb', line 209
def self.action_get_state
Vagrant::Action::Builder.new.tap do |b|
b.use HandleBox
b.use ConfigValidate
b.use ConnectVSphere
b.use GetState
b.use CloseVSphere
end
end
|
.action_halt ⇒ Object
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/vSphere/action.rb', line 123
def self.action_halt
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use Call, IsRunning do |env2, b3|
unless env2[:result]
b3.use MessageNotRunning
next
end
b3.use Call, GracefulHalt, :poweroff, :running do |env3, b4|
b4.use PowerOff unless env3[:result]
end
end
end
b.use CloseVSphere
end
end
|
.action_provision ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/vSphere/action.rb', line 34
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 Call, IsRunning do |env2, b3|
unless env2[:result]
b3.use MessageNotRunning
next
end
b3.use Provision
b3.use SyncedFolders
end
end
end
end
|
.action_reload ⇒ Object
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/vSphere/action.rb', line 148
def self.action_reload
Vagrant::Action::Builder.new.tap do |b|
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use action_halt
b2.use action_up
end
end
end
|
.action_resume ⇒ Object
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/vSphere/action.rb', line 162
def self.action_resume
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use Call, IsSuspended do |env2, b3|
unless env2[:result]
b3.use MessageNotSuspended
next
end
b3.use Resume
end
end
b.use CloseVSphere
end
end
|
.action_snapshot_delete ⇒ Object
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
# File 'lib/vSphere/action.rb', line 231
def self.action_snapshot_delete
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
if env[:result]
b2.use SnapshotDelete
else
b2.use MessageNotCreated
end
end
b.use CloseVSphere
end
end
|
.action_snapshot_list ⇒ Object
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
# File 'lib/vSphere/action.rb', line 246
def self.action_snapshot_list
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
if env[:result]
b2.use SnapshotList
else
b2.use MessageNotCreated
end
end
b.use CloseVSphere
end
end
|
.action_snapshot_restore ⇒ Object
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
# File 'lib/vSphere/action.rb', line 261
def self.action_snapshot_restore
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use SnapshotRestore
b2.use Call, IsEnvSet, :snapshot_delete do |env2, b3|
b3.use action_snapshot_delete if env2[:result]
end
b2.use action_up
end
b.use CloseVSphere
end
end
|
.action_snapshot_save ⇒ Object
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
# File 'lib/vSphere/action.rb', line 283
def self.action_snapshot_save
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
if env[:result]
b2.use SnapshotSave
else
b2.use MessageNotCreated
end
end
b.use CloseVSphere
end
end
|
.action_ssh ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/vSphere/action.rb', line 56
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 Call, IsRunning do |env2, b3|
unless env2[:result]
b3.use MessageNotRunning
next
end
b3.use SSHExec
end
end
end
end
|
.action_ssh_run ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/vSphere/action.rb', line 77
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 Call, IsRunning do |env2, b3|
unless env2[:result]
b3.use MessageNotRunning
next
end
b3.use SSHRun
end
end
end
end
|
.action_suspend ⇒ Object
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/vSphere/action.rb', line 185
def self.action_suspend
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
unless env[:result]
b2.use MessageNotCreated
next
end
b2.use Call, IsRunning do |env2, b3|
unless env2[:result]
b3.use MessageNotRunning
next
end
b3.use Suspend
end
end
b.use CloseVSphere
end
end
|
.action_up ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/vSphere/action.rb', line 98
def self.action_up
Vagrant::Action::Builder.new.tap do |b|
b.use HandleBox
b.use ConfigValidate
b.use ConnectVSphere
b.use Call, IsCreated do |env, b2|
if env[:result]
b2.use MessageAlreadyCreated
next
end
b2.use Clone
end
b.use Call, IsRunning do |env, b2|
b2.use PowerOn unless env[:result]
end
b.use CloseVSphere
b.use WaitForIPAddress
b.use WaitForCommunicator, [:running]
b.use Provision
b.use SyncedFolders
b.use SetHostname
end
end
|