diff options
author | PrajaktaPurohit <PrajaktaPurohit@users.noreply.github.com> | 2016-06-14 09:08:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-14 09:08:44 -0700 |
commit | f0caa91e00c46aac00aa85e13ad553bd7ea389f0 (patch) | |
tree | 8bc85deb4800c63047cb451b3e3b5e3c67ee5ddc | |
parent | 6b9a354728a61a0911c5d89de95a51c42004e74e (diff) | |
parent | 225cb72d1f34a8f8e200a81f04f6411e270cc388 (diff) | |
download | chef-f0caa91e00c46aac00aa85e13ad553bd7ea389f0.tar.gz |
Merge pull request #5025 from chef/praj/FLOW-334/sensitive
Remote resource should respect sensitive flag
-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 |