module HashiCorp::VagrantVMwareDesktop::Helper::Lock
The Lock
module implements some locking primitives for parallelism that respect the Vagrant version that is available.
Public Class Methods
lock(machine, name, **opts, &block)
click to toggle source
# File lib/vagrant-vmware-desktop/helper/lock.rb, line 7 def self.lock(machine, name, **opts, &block) # Before version 1.6, we don't have any sort of locking return block.call if Vagrant::VERSION < "1.6.0" # Set some defaults opts = { retry: true }.merge(opts) # Lock the environment and yield it. begin return machine.env.lock(name, &block) rescue Vagrant::Errors::EnvironmentLockedError raise if !opts[:retry] sleep 1 retry end end