summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrajakta Purohit <prajakta@opscode.com>2016-06-13 17:32:52 -0700
committerPrajakta Purohit <prajakta@opscode.com>2016-06-13 17:46:09 -0700
commit225cb72d1f34a8f8e200a81f04f6411e270cc388 (patch)
tree8bc85deb4800c63047cb451b3e3b5e3c67ee5ddc
parent6b9a354728a61a0911c5d89de95a51c42004e74e (diff)
downloadchef-praj/FLOW-334/sensitive.tar.gz
Remote resource should respect sensitive flagpraj/FLOW-334/sensitive
-rw-r--r--lib/chef/provider/remote_directory.rb2
-rw-r--r--spec/unit/provider/remote_directory_spec.rb15
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