[chef] Re: Re: Re: Lock an environment's cookbooks


Chronological Thread 
  • From: Sean Escriva < >
  • To:
  • Subject: [chef] Re: Re: Re: Lock an environment's cookbooks
  • Date: Sat, 30 Jun 2012 16:39:39 -0700

Hey John,

I just use something like this to get a formatted list that will work:

knife cookbook list | awk '{print "\""$1"\" => \"= "$2"\""}' > new_env.rb

use your favorite editor to properly edit new-env.rb and then `knife environment from file` to your hearts content.

-sme

On Fri, Jun 29, 2012 at 7:14 PM, John Dyer < " target="_blank"> > wrote:
Hey Jeremy,

 Thanks for the tip, however it didn't appear to work for me, any idea what I am doing wrong?

Last login: Wed May 30 23:31:39 on ttys021
22:10:45 (production_ec2) ~ shef -z -c ~/.chef/knife.rb
loading configuration: /Users/jdyer/.chef/knife.rb
Session type: client
Loading.......[Fri, 29 Jun 2012 22:10:52 -0400] INFO: Run List is []
[Fri, 29 Jun 2012 22:10:52 -0400] INFO: Run List expands to []
....[Fri, 29 Jun 2012 22:10:54 -0400] INFO: Loading cookbooks []
done.

This is shef, the Chef shell.
 Chef Version: 0.10.10

run `help' for help, `exit' or ^D to quit.

Ohai2u
chef > env = Chef::Environment.load('dt_prod')
 => dt_prod 
chef > env.cookbook_versions
 => {} 
chef > 

-John



On Fri, Jun 22, 2012 at 12:16 AM, Jeremy Voorhis < " target="_blank"> > wrote:
I've done this once before using shef, and it turns out to be pretty easy.

1) Fire up shef like so

 % shef -z -c ~/.chef/knife.rb

2) Load your environment

 chef > env = Chef::Environment.load('YOUR_ENV_HERE')

3) Grab your cookbook versions and format to taste.

 chef > env.cookbook_versions
 => {"build-essential"=>"= 1.0.0", … }

4) Include your output in environments/YOUR_ENV_HERE.rb

5)  Upload

 % knife environment from file environments/YOUR_ENV_HERE.rb

HTH,

Jeremy

On Jun 21, 2012, at 8:44 PM, John Dyer wrote:

> Hey Guys,
>
>  Is there any way to take an environment, which currently has no cookbook version constraints, and set each cookbook version to the latest of whats deployed on my chef server?  Would really suck to have to get the expanded run list and do "knife node show" on each...  Any other way about this ?
>
> -John






Archive powered by MHonArc 2.6.16.

§