knife-xapi 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -183,6 +183,24 @@ class Chef
183
183
  end
184
184
 
185
185
  def wait_for_guest_ip(vm_ref)
186
+ guest_ip = get_guest_ip(vm_ref)
187
+ if pingable?(guest_ip)
188
+ ui.msg "found guest_ip = #{guest_ip}"
189
+ return guest_ip
190
+ else
191
+ ui.msg "#{guest_ip} is not pingable, trying to get guest ip again"
192
+ guest_ip = get_guest_ip(vm_ref)
193
+ ui.msg "found guest_ip = #{guest_ip}"
194
+ return guest_ip
195
+ end
196
+ end
197
+
198
+ def pingable?(guest_ip, timeout=5)
199
+ sleep(20)
200
+ system "ping -c 1 -t #{timeout} #{guest_ip} >/dev/null"
201
+ end
202
+
203
+ def get_guest_ip(vm_ref)
186
204
  begin
187
205
  timeout( locate_config_value(:ping_timeout).to_i ) do
188
206
  ui.msg "Waiting for guest ip address"
@@ -1,3 +1,3 @@
1
1
  module KnifeXenserver
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-xapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-17 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef