summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/script.rb12
-rw-r--r--spec/support/shared/unit/script_resource.rb10
-rw-r--r--spec/unit/resource/script_spec.rb2
3 files changed, 6 insertions, 18 deletions
diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb
index 5173a76542..e1d71c2924 100644
--- a/lib/chef/resource/script.rb
+++ b/lib/chef/resource/script.rb
@@ -1,7 +1,7 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Tyler Cloke (<tyler@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,13 +23,11 @@ require "chef/provider/script"
class Chef
class Resource
class Script < Chef::Resource::Execute
- # Chef-13: go back to using :name as the identity attr
- identity_attr :command
+ identity_attr :name
def initialize(name, run_context = nil)
super
- # Chef-13: the command variable should be initialized to nil
- @command = name
+ @command = nil
@code = nil
@interpreter = nil
@flags = nil
@@ -38,9 +36,7 @@ class Chef
def command(arg = nil)
unless arg.nil?
- # Chef-13: change this to raise if the user is trying to set a value here
- Chef::Log.warn "Specifying command attribute on a script resource is a coding error, use the 'code' attribute, or the execute resource"
- Chef::Log.warn "This attribute is deprecated and must be fixed or this code will fail on Chef 13"
+ raise Chef::Exceptions::Script, "Do not use the command attribute on a #{resource_name} resource, use the 'code' attribute instead."
end
super
end
diff --git a/spec/support/shared/unit/script_resource.rb b/spec/support/shared/unit/script_resource.rb
index 27864e1625..a04da4b63e 100644
--- a/spec/support/shared/unit/script_resource.rb
+++ b/spec/support/shared/unit/script_resource.rb
@@ -1,7 +1,7 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Tyler Cloke (<tyler@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,10 +34,6 @@ shared_examples_for "a script resource" do
expect(script_resource.command).to be nil
end
- it "should set command to the name on the resource", chef: "< 13" do
- expect(script_resource.command).to eql script_resource.name
- end
-
it "should accept a string for the code" do
script_resource.code "hey jude"
expect(script_resource.code).to eql("hey jude")
@@ -52,10 +48,6 @@ shared_examples_for "a script resource" do
expect { script_resource.command("foo") }.to raise_error(Chef::Exceptions::Script)
end
- it "should not raise an exception if users set command on the resource", chef: "< 13" do
- expect { script_resource.command("foo") }.not_to raise_error
- end
-
describe "when executing guards" do
let(:resource) do
resource = script_resource
diff --git a/spec/unit/resource/script_spec.rb b/spec/unit/resource/script_spec.rb
index fca9fb0d7b..16f7650712 100644
--- a/spec/unit/resource/script_spec.rb
+++ b/spec/unit/resource/script_spec.rb
@@ -1,7 +1,7 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Tyler Cloke (<tyler@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");