summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-06-01 13:20:27 -0700
committerJohn Keiser <john@johnkeiser.com>2015-06-01 13:21:22 -0700
commit33df30d0f8c75b1e600da2f169fee0f8e58f694a (patch)
tree486e4d616f2f4b2d1d605ffeb96e0eec6c97f7b5
parentac9c7c7f4bb7752c14f06224cdd1157d494dc02f (diff)
downloadchef-33df30d0f8c75b1e600da2f169fee0f8e58f694a.tar.gz
-rw-r--r--CHANGELOG.md2
-rw-r--r--DOC_CHANGES.md13
2 files changed, 15 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 29abb09ca5..cdaff78a22 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,8 @@
* [pr#3397](https://github.com/chef/chef/pull/3397): Validate owner exists in directory resources
* [pr#3418](https://github.com/chef/chef/pull/3418): Add `shell_out` mixin to Chef::Resource class for use in `not_if`/`only_if` conditionals, etc.
* [pr#3406](https://github.com/chef/chef/pull/3406): Add wide-char 'Environment' to `broadcast_env_change` mixin for setting windows environment variables
+* [pr#3442](https://github.com/chef/chef/pull/3442): Add resource_name to top-level Resource class to make defining resources easier. `use_automatic_resource_name` also added, to support convention-based resource naming.
+* [pr#3447](https://github.com/chef/chef/pull/3447): Add allowed_actions and default_action to top-level Resource class.
## 12.4.0
diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md
index feea3414e8..cba06a26e6 100644
--- a/DOC_CHANGES.md
+++ b/DOC_CHANGES.md
@@ -28,6 +28,19 @@ Authors of HWRPs need to be aware that in the future all resources and providers
Users are encouraged to declare resources in their own namespaces instead of putting them in the special `Chef::Resource` namespace.
+### Resources may now use `allowed_actions` and `default_action`
+
+Instead of overriding `Chef::Resource.initialize` and setting `@allowed_actions` and `@action` in the constructor, you may now use the `allowed_actions` and `default_action` DSL to declare them:
+
+```ruby
+class MyResource < Chef::Resource
+ use_automatic_resource_name
+
+ allowed_actions :create, :delete
+ default_action :create
+end
+```
+
### LWRPs are no longer automatically placed in the `Chef::Resource` namespace
Starting with Chef 12.4.0, accessing an LWRP class by name from the `Chef::Resource` namespace will trigger a deprecation warning message. This means that if your cookbook includes the LWRP `mycookbook/resources/myresource.rb`, you will no longer be able to extend or reference `Chef::Resource::MycookbookMyresource` in Ruby code. LWRP recipe DSL does not change: the LWRP will still be available to recipes as `mycookbook_myresource`.