summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-05-12 15:10:41 -0700
committerClaire McQuin <claire@getchef.com>2014-05-13 15:21:16 -0700
commitd09ee38fa4ac3e77e75485b95a282890af35e61a (patch)
tree8806cbf9f9ec5cae1cbaf292acc64d53753551a7
parentc9426f9a0fd8e7943fd51b032999bde080c07af7 (diff)
downloadchef-d09ee38fa4ac3e77e75485b95a282890af35e61a.tar.gz
make mixin/create_path threadsafe
-rw-r--r--lib/chef/mixin/create_path.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/mixin/create_path.rb b/lib/chef/mixin/create_path.rb
index 9d1248e907..31ef81e4be 100644
--- a/lib/chef/mixin/create_path.rb
+++ b/lib/chef/mixin/create_path.rb
@@ -45,8 +45,11 @@ class Chef
file_path.each_index do |i|
create_path = File.join(file_path[0, i + 1])
unless File.directory?(create_path)
- Chef::Log.debug("Creating directory #{create_path}")
- Dir.mkdir(create_path)
+ begin
+ Chef::Log.debug("Creating directory #{create_path}")
+ Dir.mkdir(create_path)
+ rescue Errno::EEXIST
+ end
end
end
File.expand_path(File.join(file_path))