diff options
-rw-r--r-- | lib/chef/provider/remote_directory.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/remote_directory_spec.rb | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/chef/provider/remote_directory.rb b/lib/chef/provider/remote_directory.rb index e3bc579107..15b71c43bd 100644 --- a/lib/chef/provider/remote_directory.rb +++ b/lib/chef/provider/remote_directory.rb @@ -209,6 +209,8 @@ class Chef def cookbook_file_resource(target_path, relative_source_path) res = Chef::Resource::CookbookFile.new(target_path, run_context) res.cookbook_name = resource_cookbook + # Set the sensitivity level + res.sensitive(new_resource.sensitive) res.source(::File.join(source, relative_source_path)) if Chef::Platform.windows? && files_rights files_rights.each_pair do |permission, *args| diff --git a/spec/unit/provider/remote_directory_spec.rb b/spec/unit/provider/remote_directory_spec.rb index 710d6613fc..b6fd4cfc8e 100644 --- a/spec/unit/provider/remote_directory_spec.rb +++ b/spec/unit/provider/remote_directory_spec.rb @@ -99,6 +99,21 @@ describe Chef::Provider::RemoteDirectory do expect(cookbook_file.owner).to eq("toor") expect(cookbook_file.backup).to eq(23) end + + it "respects sensitive flag" do + @resource.cookbook "gondola_rides" + @resource.sensitive true + cookbook_file = @provider.send(:cookbook_file_resource, + "/target/destination/path.txt", + "relative/source/path.txt") + expect(cookbook_file.sensitive).to eq(true) + + @resource.sensitive false + cookbook_file = @provider.send(:cookbook_file_resource, + "/target/destination/path.txt", + "relative/source/path.txt") + expect(cookbook_file.sensitive).to eq(false) + end end describe "when creating the remote directory" do |