[chef] Re: script to change node's environment works in shef but not w/knife exec


Chronological Thread 
  • From: Steven Danna < >
  • To:
  • Subject: [chef] Re: script to change node's environment works in shef but not w/knife exec
  • Date: Mon, 9 Jan 2012 07:36:58 -0800

Hi,

On Mon, Jan 9, 2012 at 4:39 AM, Bryan Berry 
< >
 wrote:
> This is very strange. Am I doing something that can't be accomplished
> with knife exec?

Do you get any error messages?  How are you determining that the
environment isn't being changed?

> query = ARGV[0]     # i type this in when using shef
> new_environment = ARGV[1]

On recent versions of Chef, this should be ARGV[2] and ARGV[3] as Ranjib said.

> my_nodes = search(:node, "#{query}")
>
> my_nodes.each do |n|
>  n.chef_environment new_environment
>  n.save
> end
>
> exit 0

I tested this basic script using Chef 0.10.8 and it worked as far as I
could tell.

Cheers,

Steven



Archive powered by MHonArc 2.6.16.

§