summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorKartik Null Cating-Subramanian <ksubramanian@chef.io>2016-04-26 10:18:55 -0400
committerKartik Null Cating-Subramanian <ksubramanian@chef.io>2016-04-26 10:18:55 -0400
commit90daa00422b0bb05973ca17ff1b1e7be401998de (patch)
tree1c00c24fa1dd04172d121dedd2d3b53a257f1d67 /lib/chef
parent24a180a6988b022776865a2fbe448555a930f691 (diff)
parentfa2a9b0a2b8468ad099a08213638971070309a7e (diff)
downloadchef-90daa00422b0bb05973ca17ff1b1e7be401998de.tar.gz
Merge pull request #4642 from chef/ksubrama/fips_acceptance
Run the integration tests in FIPS mode
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/provider/directory.rb16
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