- From: Sean OMeara <
>
- To: "
" <
>
- Subject: [chef] Re: A new kind of Resource: the resource cookbook
- Date: Fri, 20 Feb 2015 11:26:00 -0800
This is a *big deal*.
This is going to change the way people write Chef.
+1000
-s
On Thu, Feb 19, 2015 at 3:56 PM, John Keiser
<
>
wrote:
>
Hey all,
>
>
Chef Resources are incredibly important to creating good, useful, reusable
>
cookbooks. Yet people often don't create them because it's harder than it
>
should be. We need to change that.
>
>
The "resource" cookbook, released today, is a big step in that direction,
>
making Chef resources both more powerful and much easier to write, use, and
>
customize. I'd love your thoughts on this new shape for a resource.
>
>
Some of the key ideas:
>
- Simplify resources to a single file, using "recipe" and removing
>
providers.
>
- Make primitive resources easy with the "converge" and "load" keywords."
>
- Make resources readable as well as writeable.
>
- Make it easy to customize resources in place, adding defaults and tweaks.
>
>
To use it,
>
1. Grab the resource cookbook
>
2. Add "depends 'resource'" to your cookbook's metadata
>
3. Write a resource (say, and use it!
>
>
# resources/user_data.rb
>
property :path, Path, identity: true, default: '/etc/httpd.conf'
>
property :full_name, String
>
property :total, Integer
>
recipe do
>
file path do
>
content "FullName '#{full_name}'\nTotal #{total}"
>
end
>
end
>
>
I'd love to get feedback and people trying it out. This is experimental at
>
this time, though! There are bugs (though all known bugs are presently
>
fixed). Things will change. There is a lot of feedback to gather and that
>
will affect what it does. On the other hand, this has been through a long
>
revision cycle already in an attempt to produce something close enough to
>
right that I hope it won't change *much,* or in fundamental ways.
>
>
For a quickstart and documentation, see the cookbook or the README on the
>
repository.
>
For a detailed feature list and in-depth comparison between Chef HWRP/LWRPs
>
and the resource cookbook, see the 0.1 release notes.
>
The rubygems cookbook example is being used to manage gem ownership for Chef
>
gems, and serves as an initial example of an API cookbook.
>
>
Join us on gitter if you want to chat, or feel free to file issues for
>
things you'd like, things you don't like that are there, things you'd like
>
to change.
>
>
Thanks!
>
>
--John Keiser
>
>
Archive powered by MHonArc 2.6.16.