Sha256: 40e0196744222eb7ff00a78799a1d5e532373e4166750df4700615aa44a090b2
Contents?: true
Size: 945 Bytes
Versions: 13
Compression:
Stored size: 945 Bytes
Contents
require 'timeout' module VagrantPlugins module Skytap module API module Busyable WAIT_TIMEOUT = 300 WAIT_ITERATION_PERIOD = 2 def update_with_retry(attrs, path=nil) retry_while_resource_busy do resp = api_client.put(path || url, JSON.dump(attrs)) refresh(JSON.load(resp.body)) break end end def retry_while_resource_busy(timeout=WAIT_TIMEOUT, &block) begin Timeout.timeout(timeout) do loop do break if env[:interrupted] # is this right? begin yield rescue Errors::ResourceBusy end sleep WAIT_ITERATION_PERIOD end end rescue Timeout::Error => ex raise Errors::InstanceReadyTimeout, timeout: timeout end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems