Module: VagrantPlugins::OpenNebulaProvider::Action
- Includes:
- Vagrant::Action::Builtin
- Defined in:
- lib/opennebula-provider/action.rb,
lib/opennebula-provider/action/stop.rb,
lib/opennebula-provider/action/start.rb,
lib/opennebula-provider/action/create.rb,
lib/opennebula-provider/action/resume.rb,
lib/opennebula-provider/action/destroy.rb,
lib/opennebula-provider/action/suspend.rb,
lib/opennebula-provider/action/messages.rb,
lib/opennebula-provider/action/check_state.rb,
lib/opennebula-provider/action/wait_for_ssh.rb,
lib/opennebula-provider/action/read_ssh_info.rb,
lib/opennebula-provider/action/wait_for_state.rb
Defined Under Namespace
Classes: CheckState, Create, Destroy, MessageAlreadyCreated, MessageAlreadyDestroyed, MessageAlreadyHalted, MessageAlreadySuspended, MessageHalted, MessageInErrorState, MessageNotCreated, MessageSuspended, MessageWillNotDestroy, ReadSSHInfo, Resume, Start, Stop, Suspend, WaitForSSH, WaitForState
Class Method Summary
collapse
Class Method Details
.check_state ⇒ Object
136
137
138
139
140
141
|
# File 'lib/opennebula-provider/action.rb', line 136
def self.check_state
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use CheckState
end
end
|
.destroy ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/opennebula-provider/action.rb', line 18
def self.destroy
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env, b1|
case env[:machine_state]
when :active, :error, :suspended, :inactive, :stopped
b1.use Call, DestroyConfirm do |env1, b2|
if env1[:result]
b2.use Destroy
b2.use ProvisionerCleanup if defined?(ProvisionerCleanup)
else
b2.use MessageWillNotDestroy
end
end
when :not_created
b1.use MessageNotCreated
next
end
end
end
end
|
.halt ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/opennebula-provider/action.rb', line 65
def self.halt
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env1, b1|
case env1[:machine_state]
when :active
b1.use Stop
b1.use WaitForState, :stopped
when :suspended
b1.use MessageSuspended
when :stopped
b1.use MessageAlreadyHalted
when :not_created, :inactive
b1.use MessageNotCreated
end
end
end
end
|
.provision ⇒ Object
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# File 'lib/opennebula-provider/action.rb', line 143
def self.provision
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env1, b1|
case env1[:machine_state]
when :not_created, :inactive
b1.use MessageNotCreated
when :suspended
b1.use MessageSuspended
when :stopped
b1.use MessageHalted
else
b1.use Provision
end
end
end
end
|
.read_ssh_info ⇒ Object
161
162
163
164
165
|
# File 'lib/opennebula-provider/action.rb', line 161
def self.read_ssh_info
Vagrant::Action::Builder.new.tap do |b|
b.use ReadSSHInfo
end
end
|
.reload ⇒ Object
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/opennebula-provider/action.rb', line 120
def self.reload
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env1, b1|
case env1[:machine_state]
when :not_created
b1.use MessageNotCreated
next
end
b1.use halt
b1.use up
end
end
end
|
.resume ⇒ Object
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/opennebula-provider/action.rb', line 102
def self.resume
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env1, b1|
case env1[:machine_state]
when :suspended
when :stopped
b1.use MessageHalted
when :not_created, :inactive
b1.use MessageNotCreated
end
end
end
end
|
.ssh ⇒ Object
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
# File 'lib/opennebula-provider/action.rb', line 185
def self.ssh
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env1, b1|
case env1[:machine_state]
when :not_created, :inactive
b1.use MessageNotCreated
when :suspended
b1.use MessageSuspended
when :stopped
b1.use MessageStopped
else
b1.use SSHExec
end
end
end
end
|
.ssh_run ⇒ Object
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/opennebula-provider/action.rb', line 167
def self.ssh_run
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env1, b1|
case env1[:machine_state]
when :not_created, :inactive
b1.use MessageNotCreated
when :suspended
b1.use MessageSuspended
when :stopped
b1.use MessageStopped
else
b1.use SSHRun
end
end
end
end
|
.suspend ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/opennebula-provider/action.rb', line 84
def self.suspend
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env1, b1|
case env1[:machine_state]
when :active
when :suspended
b1.use MessageAlreadySuspended
when :not_created, :inactive
b1.use MessageNotCreated
end
end
end
end
|
.up ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/opennebula-provider/action.rb', line 40
def self.up
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, CheckState do |env, b1|
case env[:machine_state]
when :active
b1.use MessageAlreadyCreated
next
when :suspended
when :stopped
b1.use Start
when :not_created, :inactive
b1.use Create
when :error
b1.use MessageInErrorState
next
end
b1.use WaitForCommunicator, [:pending, :prolog, :boot, :active]
b1.use SyncedFolders
end
end
end
|