chef-undev 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ class Chef::RunLock
2
+
3
+ def acquire
4
+ # ensure the runlock_file path exists
5
+ create_path(File.dirname(runlock_file))
6
+ @runlock = File.open(runlock_file,'w+')
7
+ unless runlock.flock(File::LOCK_EX|File::LOCK_NB)
8
+ # Another chef client running...
9
+ runpid = runlock.read.strip.chomp
10
+ Chef::Log.warn("Chef client #{runpid} is running, will wait for it to finish and then run.")
11
+ runlock.flock(File::LOCK_EX)
12
+ end
13
+ # We grabbed the run lock. Save the pid.
14
+ runlock.truncate(0)
15
+ runlock.rewind # truncate doesn't reset position to 0.
16
+ runlock.write(Process.pid.to_s)
17
+ end
18
+
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Chef
2
2
  module Undev
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
data/lib/chef/undev.rb CHANGED
@@ -2,3 +2,4 @@ require 'nyan-cat-chef-formatter'
2
2
  require_relative 'undev/formatters/silent'
3
3
  require_relative 'undev/handler/reporter'
4
4
  require_relative 'undev/monkey_patches/ohai_dirs'
5
+ require_relative 'undev/monkey_patches/run_lock'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-undev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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-08-19 00:00:00.000000000 Z
12
+ date: 2013-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -93,6 +93,7 @@ files:
93
93
  - lib/chef/undev/handler/reporter.rb
94
94
  - lib/chef/undev/monkey_patches/load_prior_resource.rb
95
95
  - lib/chef/undev/monkey_patches/ohai_dirs.rb
96
+ - lib/chef/undev/monkey_patches/run_lock.rb
96
97
  - lib/chef/undev/monkey_patches/verbose.rb
97
98
  - lib/chef/undev/support/color_diff.rb
98
99
  - lib/chef/undev/version.rb