diff options
author | John Keiser <john@johnkeiser.com> | 2015-09-25 07:20:03 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-09-25 12:22:19 -0700 |
commit | af422456552b8a64cb3ea90167a0f80f401790cf (patch) | |
tree | 7d5edfd97aefaf4884c6f941070ca12df58fffe6 | |
parent | 424b2dda9b4a2a0ca3e7ca8c9a598643b303ec0f (diff) | |
download | chef-af422456552b8a64cb3ea90167a0f80f401790cf.tar.gz |
Fix up property deprecation text
-rw-r--r-- | lib/chef/property.rb | 2 | ||||
-rw-r--r-- | spec/unit/property_spec.rb | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 6c9d4619b1..011ff93aef 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -99,7 +99,7 @@ class Chef if preferred_default == :default && options[:default].nil? preferred_default = found_defaults[1] end - Chef::Log.deprecation("Cannot specify keys #{found_defaults.join(", ")} together on property #{options[:name]}--only one (#{preferred_default}) will be obeyed. In Chef 13, specifying multiple defaults will become an error.", caller(5..5)[0]) + Chef.log_deprecation("Cannot specify keys #{found_defaults.join(", ")} together on property #{options[:name]}#{options[:resource_class] ? " of resource #{options[:resource_class].resource_name}" : ""}. Only one (#{preferred_default}) will be obeyed. In Chef 13, specifying multiple defaults will become an error.") # Only honor the preferred default options.reject! { |k,v| found_defaults.include?(k) && k != preferred_default } end diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb index ebf94c1dd0..6415286397 100644 --- a/spec/unit/property_spec.rb +++ b/spec/unit/property_spec.rb @@ -949,19 +949,19 @@ describe "Chef::Resource.property" do context "default ordering deprecation warnings" do it "emits a deprecation warning for property :x, default: 10, #{name}: true" do expect { resource_class.property :x, :default => 10, name.to_sym => true }.to raise_error Chef::Exceptions::DeprecatedFeatureError, - /Cannot specify keys default, #{name} together on property x--only one \(default\) will be obeyed./ + /Cannot specify keys default, #{name} together on property x. Only one \(default\) will be obeyed./ end it "emits a deprecation warning for property :x, default: nil, #{name}: true" do expect { resource_class.property :x, :default => nil, name.to_sym => true }.to raise_error Chef::Exceptions::DeprecatedFeatureError, - /Cannot specify keys default, #{name} together on property x--only one \(#{name}\) will be obeyed./ + /Cannot specify keys default, #{name} together on property x. Only one \(#{name}\) will be obeyed./ end it "emits a deprecation warning for property :x, #{name}: true, default: 10" do expect { resource_class.property :x, name.to_sym => true, :default => 10 }.to raise_error Chef::Exceptions::DeprecatedFeatureError, - /Cannot specify keys #{name}, default together on property x--only one \(#{name}\) will be obeyed./ + /Cannot specify keys #{name}, default together on property x. Only one \(#{name}\) will be obeyed./ end it "emits a deprecation warning for property :x, #{name}: true, default: nil" do expect { resource_class.property :x, name.to_sym => true, :default => nil }.to raise_error Chef::Exceptions::DeprecatedFeatureError, - /Cannot specify keys #{name}, default together on property x--only one \(#{name}\) will be obeyed./ + /Cannot specify keys #{name}, default together on property x. Only one \(#{name}\) will be obeyed./ end end context "default ordering" do |