diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-11-18 22:50:35 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-11-19 15:42:30 -0800 |
commit | 999793d7f8c23fd9a533d3c8dd5fa57e7405ebd1 (patch) | |
tree | 16df4c43cd85831aca2e24215bd69e2888bf6f22 /lib/chef/node | |
parent | 1d0ae0156e14d0366d8b171361613abeea92917c (diff) | |
download | chef-999793d7f8c23fd9a533d3c8dd5fa57e7405ebd1.tar.gz |
fix ImmutableAttributeModification exception
Diffstat (limited to 'lib/chef/node')
-rw-r--r-- | lib/chef/node/attribute.rb | 2 | ||||
-rw-r--r-- | lib/chef/node/immutable_collections.rb | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 56034a60e4..dc97aa600b 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -381,7 +381,7 @@ class Chef end def []=(key, value) - raise "this should just raise an immutable attribute exception" + raise Exceptions::ImmutableAttributeModification end def has_key?(key) diff --git a/lib/chef/node/immutable_collections.rb b/lib/chef/node/immutable_collections.rb index 3558ba3a86..af04ef26d4 100644 --- a/lib/chef/node/immutable_collections.rb +++ b/lib/chef/node/immutable_collections.rb @@ -78,9 +78,7 @@ class Chef # Ruby 1.8 blocks can't have block arguments, so we must use string eval: class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) def #{mutator_method_name}(*args, &block) - msg = "Node attributes are read-only when you do not specify which precedence level to set. " + - %Q(To set an attribute use code like `node.default["key"] = "value"') - raise Exceptions::ImmutableAttributeModification, msg + raise Exceptions::ImmutableAttributeModification end METHOD_DEFN end @@ -165,9 +163,7 @@ class Chef # Ruby 1.8 blocks can't have block arguments, so we must use string eval: class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) def #{mutator_method_name}(*args, &block) - msg = "Node attributes are read-only when you do not specify which precedence level to set. " + - %Q(To set an attribute use code like `node.default["key"] = "value"') - raise Exceptions::ImmutableAttributeModification, msg + raise Exceptions::ImmutableAttributeModification end METHOD_DEFN end |