diff options
author | Kartik Null Cating-Subramanian <ksubramanian@chef.io> | 2016-04-21 13:26:30 -0400 |
---|---|---|
committer | Kartik Null Cating-Subramanian <ksubramanian@chef.io> | 2016-04-25 12:04:09 -0400 |
commit | 2034305917a76d4c203e457a9ebf61d28819ccbd (patch) | |
tree | d43562f4902ab0db80b4178ffefbdff825f4d66f /lib | |
parent | d5039e38977b9da431fcb52670576561d772aa27 (diff) | |
download | chef-2034305917a76d4c203e457a9ebf61d28819ccbd.tar.gz |
Too much log output and unnecessary warnings! Suppress that shit.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/provider/directory.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/chef/provider/directory.rb b/lib/chef/provider/directory.rb index 3235a28cd1..7cc05259b6 100644 --- a/lib/chef/provider/directory.rb +++ b/lib/chef/provider/directory.rb @@ -50,7 +50,21 @@ class Chef # Make sure the parent dir exists, or else fail. # for why run, print a message explaining the potential error. parent_directory = ::File.dirname(@new_resource.path) - a.assertion { @new_resource.recursive || ::File.directory?(parent_directory) } + a.assertion do + if @new_resource.recursive + does_parent_exist = lambda do |base_dir| + base_dir = ::File.dirname(base_dir) + if ::File.exist?(base_dir) + ::File.directory?(base_dir) + else + does_parent_exist.call(base_dir) + end + end + does_parent_exist.call(@new_resource.path) + else + ::File.directory?(parent_directory) + end + end a.failure_message(Chef::Exceptions::EnclosingDirectoryDoesNotExist, "Parent directory #{parent_directory} does not exist, cannot create #{@new_resource.path}") a.whyrun("Assuming directory #{parent_directory} would have been created") end |