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


Chronological Thread 
  • From: Bryan Berry < >
  • To:
  • Subject: [chef] Re: script to change node's environment works in shef but not w/knife exec
  • Date: Mon, 9 Jan 2012 14:23:39 +0100

I tried the work around on this ticket
http://tickets.opscode.com/browse/CHEF-1910
nodes.transform("name:NODE_NAME") {|n| n.chef_environment = "ENVIRONMENT"}

but still no joy :(

On Mon, Jan 9, 2012 at 1:39 PM, Bryan Berry 
< >
 wrote:
> This is very strange. Am I doing something that can't be accomplished
> with knife exec?
>
> it works perfectly when I run it from shef on my workstation
>
> # usage knife exec ./change_env.rb query environment_name
>
> query = ARGV[0]     # i type this in when using shef
> new_environment = ARGV[1]
>
> my_nodes = search(:node, "#{query}")
>
> my_nodes.each do |n|
>  n.chef_environment new_environment
>  n.save
> end
>
> exit 0



Archive powered by MHonArc 2.6.16.

§