[chef] Re: Re: "edit" your resources in a library cookbook from an application cookbook


Chronological Thread 
  • From: Adam Jacob < >
  • To: " " < >
  • Subject: [chef] Re: Re: "edit" your resources in a library cookbook from an application cookbook
  • Date: Tue, 13 Nov 2012 17:36:55 +0000
  • Accept-language: en-US

I think this is rad, Bryan. I've been using this pattern in cookbooks for a long time, and it never occurred to me what I was just copying ridiculous boilerplate.

Thanks!

Adam


Dear Chef users!

chef-edit has been renamed chef-rewind https://github.com/bryanwb/chef-rewind  , enjoy!

# file postgresql/recipes/server.rb
user "postgres" do
  uid  26
  home '/home/postgres'
  supports  :manage_home => true
end

# file my-postgresql/recipes/
require 'chef/edit'

include_recipe "postgresql::server"

rewind "user[postgres]"
  home '/var/lib/pgsql/9.2'
end

On Wed, Nov 7, 2012 at 6:51 PM, Bryan Berry < " target="_blank"> > wrote:
ahead of tomorrow's G+ hangout on Cookbook reusability, I whipped up
this little gem that embodies what I have in mind for making cookbooks
more reusable. This is _alpha_ level code.

chef-edit essentially allows you to reopen an existing resource. It is
mostly just syntactic sugar on top of the Chef::Recipe.resources
method

https://github.com/bryanwb/chef-edit

Add this line to your application's Gemfile:

## Installation

gem 'chef-edit'
And then execute:

Or install it yourself as:

$ gem install chef-edit

## Usage

# file postgresql/recipes/server.rb
user "postgres" do
  uid  26
  home '/home/postgres'
  supports  :manage_home => true
end

# file my-postgresql/recipes/
require 'chef/edit'

include_recipe "postgresql::server"

edit "user[postgres]"
  home '/var/lib/pgsql/9.2'
end




Archive powered by MHonArc 2.6.16.

§