virtualbox-guestcontrol 1.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,7 +52,6 @@ module VirtualBox
|
|
52
52
|
before_transition any => :running do |machine, transition|
|
53
53
|
Shellter.run!(machine.vbox_manage, "startvm", ":name", :name => machine.name)
|
54
54
|
machine.wait_until { machine.running? }
|
55
|
-
machine.wait_until { machine.guest_additions_started? }
|
56
55
|
end
|
57
56
|
|
58
57
|
before_transition :running => :poweroff do |machine, transition|
|
@@ -91,6 +90,17 @@ module VirtualBox
|
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
93
|
+
state :starting do
|
94
|
+
def status
|
95
|
+
"Starting Up"
|
96
|
+
end
|
97
|
+
|
98
|
+
def execute(*arguments)
|
99
|
+
wait_until { running? }
|
100
|
+
execute(*arguments)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
94
104
|
state :running do
|
95
105
|
def status
|
96
106
|
"Running"
|
@@ -155,7 +165,16 @@ module VirtualBox
|
|
155
165
|
end
|
156
166
|
|
157
167
|
def state
|
158
|
-
environment[:VMState]
|
168
|
+
state_name = environment[:VMState]
|
169
|
+
if state_name == "running"
|
170
|
+
if guest_additions_started?
|
171
|
+
state_name
|
172
|
+
else
|
173
|
+
"starting"
|
174
|
+
end
|
175
|
+
else
|
176
|
+
state_name
|
177
|
+
end
|
159
178
|
end
|
160
179
|
|
161
180
|
def guest_additions_started?
|
@@ -183,12 +202,16 @@ module VirtualBox
|
|
183
202
|
|
184
203
|
|
185
204
|
def environment
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
205
|
+
begin
|
206
|
+
result = Shellter.run!(vbox_manage, "showvminfo", ":name", "--machinereadable", :name => name)
|
207
|
+
{}.with_indifferent_access.tap do |map|
|
208
|
+
result.stdout.read.lines.each do |line|
|
209
|
+
name, value = line.strip.split("=").map { |y| y.gsub(/(^"|"$)/, "") }
|
210
|
+
map[name] = value
|
211
|
+
end
|
191
212
|
end
|
213
|
+
rescue
|
214
|
+
{}
|
192
215
|
end
|
193
216
|
end
|
194
217
|
|