summaryrefslogtreecommitdiff
path: root/lib/chef/run_lock.rb
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-05-06 15:22:10 -0700
committerClaire McQuin <claire@getchef.com>2014-05-06 15:22:10 -0700
commitda7c849754566ec3ecf4709deeab6253a5bde135 (patch)
tree69ebf15b4ac08d621ef8376fc5e82fcdf1159db0 /lib/chef/run_lock.rb
parent07f57b179967f78976d75295abbae8ac6b7551b6 (diff)
downloadchef-da7c849754566ec3ecf4709deeab6253a5bde135.tar.gz
convert cli argument to int, tidy exception message
Diffstat (limited to 'lib/chef/run_lock.rb')
-rw-r--r--lib/chef/run_lock.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/run_lock.rb b/lib/chef/run_lock.rb
index 68f697bb2b..cefe637db6 100644
--- a/lib/chef/run_lock.rb
+++ b/lib/chef/run_lock.rb
@@ -46,6 +46,7 @@ class Chef
@runlock_file = lockfile
@runlock = nil
@mutex = nil
+ @runpid = nil
end
# Acquire the system-wide lock. Will block indefinitely if another process
@@ -151,6 +152,7 @@ class Chef
def reset
@runlock = nil
@mutex = nil
+ @runpid = nil
end
# Since flock mechanism doesn't exist on windows we are using
@@ -166,7 +168,7 @@ class Chef
end
def runpid
- runlock.read.strip
+ @runpid ||= runlock.read.strip
end
def timeout_given?
@@ -178,8 +180,9 @@ class Chef
end
def exit_from_timeout
+ rp = runpid
release # Just to be on the safe side...
- raise Chef::Exceptions::RunLockTimeout.new(time_to_wait, runpid)
+ raise Chef::Exceptions::RunLockTimeout.new(time_to_wait, rp)
end
end
end