virtualbox-guestcontrol 1.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- result = Shellter.run!(vbox_manage, "showvminfo", ":name", "--machinereadable", :name => name)
187
- {}.with_indifferent_access.tap do |map|
188
- result.stdout.read.lines.each do |line|
189
- name, value = line.strip.split("=").map { |y| y.gsub(/(^"|"$)/, "") }
190
- map[name] = value
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
 
@@ -1,5 +1,5 @@
1
1
  module VirtualBox
2
2
  module GuestControl
3
- VERSION = "1.1"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtualbox-guestcontrol
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: