summaryrefslogtreecommitdiff
path: root/lib/chef/run_lock.rb
diff options
context:
space:
mode:
authorSeth Chisamore <schisamo@opscode.com>2012-11-17 15:26:31 -0500
committerSeth Chisamore <schisamo@opscode.com>2012-11-17 15:26:31 -0500
commit6d7fd257a4c64e548f90faa7dc9212f14270e1f7 (patch)
treee8c8a229d8c6e9661f32dd7da78bff1d491a5c84 /lib/chef/run_lock.rb
parent55a1a45dfc54e12820d2bdb76cc8eebf05be9675 (diff)
downloadchef-6d7fd257a4c64e548f90faa7dc9212f14270e1f7.tar.gz
[CHEF-3617] create full path of run lock file
Diffstat (limited to 'lib/chef/run_lock.rb')
-rw-r--r--lib/chef/run_lock.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/chef/run_lock.rb b/lib/chef/run_lock.rb
index ffe4d66045..c63895e87b 100644
--- a/lib/chef/run_lock.rb
+++ b/lib/chef/run_lock.rb
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+require 'chef/mixin/create_path'
+
class Chef
# == Chef::RunLock
@@ -24,6 +26,8 @@ class Chef
# Used by Chef::Client to ensure only one instance of chef-client (or solo)
# is modifying the system at a time.
class RunLock
+ include Chef::Mixin::CreatePath
+
attr_reader :runlock
attr_reader :runlock_file
@@ -48,6 +52,8 @@ class Chef
#
# The implementation is based on File#flock (see also: flock(2)).
def acquire
+ # ensure the runlock_file path exists
+ create_path(File.dirname(runlock_file))
@runlock = File.open(runlock_file,'w+')
unless runlock.flock(File::LOCK_EX|File::LOCK_NB)
# Another chef client running...