Node won't stay in configured environment

I have this node I want to change from my “preproduction” to "production"
chef environment.

If I edit the node in the Web UI, when I submit the form it says that my
node is in the correct environment. But if I recheck the node list or
refresh the node list, it still says “preproduction”.

If I use knife like this:

knife exec -E ‘nodes.transform(“name:my-node-name-in-chef”) { |n|
n.chef_environment(“production”) }’

and then do a

knife node show my-node-name-in-chef

It still say “preproduction” too… except that odd time when it DID said
production, as expected… but got back to “preproduction” on next call to
knife node show.

Any idea what can alter the node environment like this?

This is on chef-server 0.10.0 and chef-client 0.10.4 (I know, should upgrade
my server)

On Thu, Oct 20, 2011 at 11:16 AM, Benoit Caron benoit@patentemoi.ca wrote:

I have this node I want to change from my "preproduction" to "production"
chef environment.

If I edit the node in the Web UI, when I submit the form it says that my
node is in the correct environment. But if I recheck the node list or
refresh the node list, it still says "preproduction".

If I use knife like this:

knife exec -E 'nodes.transform("name:my-node-name-in-chef") { |n|
n.chef_environment("production") }'

and then do a

knife node show my-node-name-in-chef

It still say "preproduction" too... except that odd time when it DID said
production, as expected... but got back to "preproduction" on next call to
knife node show.

Is it possible that you have the environment set in /etc/chef/client.rb on
that node and that the node is running chef-client very frequently?

Cheers,

Steven

On Thu, Oct 20, 2011 at 2:20 PM, Steven Danna steve@opscode.com wrote:

On Thu, Oct 20, 2011 at 11:16 AM, Benoit Caron benoit@patentemoi.cawrote:

I have this node I want to change from my "preproduction" to "production"
chef environment.

If I edit the node in the Web UI, when I submit the form it says that my
node is in the correct environment. But if I recheck the node list or
refresh the node list, it still says "preproduction".

If I use knife like this:

knife exec -E 'nodes.transform("name:my-node-name-in-chef") { |n|
n.chef_environment("production") }'

and then do a

knife node show my-node-name-in-chef

It still say "preproduction" too... except that odd time when it DID said
production, as expected... but got back to "preproduction" on next call to
knife node show.

Is it possible that you have the environment set in /etc/chef/client.rb on
that node and that the node is running chef-client very frequently?

client.rb is very slim, as configured by knife bootstrap:

$ cat /etc/chef/client.rb
log_level :info
log_location STDOUT
chef_server_url "http://chefserver/"
validation_client_name "chef-validator"

Using default node name (fqdn)

But I think the init.d configuration for chef is somewhat broken: the
interval seems to be missing in the running chef-client process:

/usr/bin/ruby1.8 /usr/bin/chef-client -d -P /var/run/chef/client.pid -L -c
-i -s

An empty -i value would make my node continuously converge?

It make sense: after stopping chef-client on the node, I can use knife to
change the environment while not being overwritten.

This is under Debian Squeeze, looks like the init.d is incorrect?