summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2017-03-08 11:54:58 +0000
committerThom May <thom@chef.io>2017-03-08 11:54:58 +0000
commit328ca3bc97496282d988c98446882601cfdfc554 (patch)
tree548f839bea45b997668f88c0f0be89906261ea1d
parent33a2b809ba7dd22ff1d269fcd8bdfc5b78827a0c (diff)
downloadchef-328ca3bc97496282d988c98446882601cfdfc554.tar.gz
Remove %{file} from verify interpolationtm/remove_path_validation_var
Signed-off-by: Thom May <thom@chef.io>
-rw-r--r--lib/chef/resource/file/verification.rb9
-rw-r--r--spec/unit/resource/file/verification_spec.rb22
2 files changed, 10 insertions, 21 deletions
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index 3400684bc5..079e6dc201 100644
--- a/lib/chef/resource/file/verification.rb
+++ b/lib/chef/resource/file/verification.rb
@@ -106,15 +106,10 @@ class Chef
# We reuse Chef::GuardInterpreter in order to support
# the same set of options that the not_if/only_if blocks do
def verify_command(path, opts)
- # First implementation interpolated `file`; docs & RFC claim `path`
- # is interpolated. Until `file` can be deprecated, interpolate both.
if @command.include?("%{file}")
- Chef.deprecated(:verify_file,
- "%{file} is deprecated in verify command and will not be "\
- "supported in Chef 13. Please use %{path} instead."
- )
+ raise ArgumentError, "The %{file} expansion for verify commands has been removed. Please use %{path} instead."
end
- command = @command % { :file => path, :path => path }
+ command = @command % { :path => path }
interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts)
interpreter.evaluate
end
diff --git a/spec/unit/resource/file/verification_spec.rb b/spec/unit/resource/file/verification_spec.rb
index 6416bb3ad8..feacd715a4 100644
--- a/spec/unit/resource/file/verification_spec.rb
+++ b/spec/unit/resource/file/verification_spec.rb
@@ -81,24 +81,18 @@ describe Chef::Resource::File::Verification do
end
end
- it "substitutes \%{file} with the path" do
+ it "raises an error when \%{file} is used" do
test_command = platform_specific_verify_command("file")
- v = Chef::Resource::File::Verification.new(parent_resource, test_command, {})
- expect(v.verify(temp_path)).to eq(true)
- end
-
- it "warns about deprecation when \%{file} is used" do
- expect(Chef).to receive(:deprecated).with(:verify_file, /%{file} is deprecated/)
- test_command = platform_specific_verify_command("file")
- Chef::Resource::File::Verification.new(parent_resource, test_command, {})
- .verify(temp_path)
+ expect do
+ Chef::Resource::File::Verification.new(parent_resource, test_command, {}).verify(temp_path)
+ end.to raise_error(ArgumentError)
end
- it "does not warn about deprecation when \%{file} is not used" do
- expect(Chef::Log).to_not receive(:deprecation)
+ it "does not raise an error when \%{file} is not used" do
test_command = platform_specific_verify_command("path")
- Chef::Resource::File::Verification.new(parent_resource, test_command, {})
- .verify(temp_path)
+ expect do
+ Chef::Resource::File::Verification.new(parent_resource, test_command, {}).verify(temp_path)
+ end.to_not raise_error
end
it "substitutes \%{path} with the path" do