COOK-3276 - change attributes from normal to default


#1

Ohai Chefs,

We just merged COOK-3276, which changes the attribute setting in the various service recipes to node.default instead of node.set (#normal). After this change you may have unnecessary attribute settings on your nodes, which can be removed using knife exec. The :all argument to transform will modify all nodes. The argument can be a search query (e.g., “chef_environment:dev”).

knife exec -E “nodes.transform(:all) {|n| n.normal[‘chef_client’].delete(‘bin’) }”

One could also delete the chef_client attribute tree entirely, since there shouldn’t be any other “normal” level attributes set.

knife exec -E “nodes.transform(:all) {|n| n.normal.delete(‘chef_client’) }”

COOK-3276 isn’t in the current version, only on the master branch, but this will be in an upcoming release of the cookbook.

Cheers,
Joshua


#2

What’s the risk of leaving these node attributes there?
Especially if I’ve set normal/override level attributes for chef
client in other instances, is this operation considered 100% safe?

-M

On Tue, Jul 9, 2013 at 2:39 PM, Joshua Timberman joshua@opscode.com wrote:

Ohai Chefs,

We just merged COOK-3276, which changes the attribute setting in the various service recipes to node.default instead of node.set (#normal). After this change you may have unnecessary attribute settings on your nodes, which can be removed using knife exec. The :all argument to transform will modify all nodes. The argument can be a search query (e.g., “chef_environment:dev”).

knife exec -E “nodes.transform(:all) {|n| n.normal[‘chef_client’].delete(‘bin’) }”

One could also delete the chef_client attribute tree entirely, since there shouldn’t be any other “normal” level attributes set.

knife exec -E “nodes.transform(:all) {|n| n.normal.delete(‘chef_client’) }”

COOK-3276 isn’t in the current version, only on the master branch, but this will be in an upcoming release of the cookbook.

Cheers,
Joshua


#3

The first knife-exec command removes only the “bin” attribute which was converted from “normal” to “default” level in the ticket.

The second knife-exec command does remove all the “normal” level chef_client attributes. The only one we specifically set in the cookbook is “bin”, so if you set others you should not use the second command lest they all may be removed.

The only place you can set “normal” level attributes is in a recipe or by modifying the node object directly on the server. So if you’re using “override” e.g. in a role, that will have priority over these and is 100% safe. If you’re using “node.set” in e.g. a “wrapper” cookbook, then this might not be safe, especially if you’re doing this for the “bin” attribute. I can’t say for sure as I don’t know the shape of the world here :).

-joshua

On Jul 9, 2013, at 1:36 PM, Mike miketheman@gmail.com wrote:

What’s the risk of leaving these node attributes there?
Especially if I’ve set normal/override level attributes for chef
client in other instances, is this operation considered 100% safe?

-M

On Tue, Jul 9, 2013 at 2:39 PM, Joshua Timberman joshua@opscode.com wrote:

Ohai Chefs,

We just merged COOK-3276, which changes the attribute setting in the various service recipes to node.default instead of node.set (#normal). After this change you may have unnecessary attribute settings on your nodes, which can be removed using knife exec. The :all argument to transform will modify all nodes. The argument can be a search query (e.g., “chef_environment:dev”).

knife exec -E “nodes.transform(:all) {|n| n.normal[‘chef_client’].delete(‘bin’) }”

One could also delete the chef_client attribute tree entirely, since there shouldn’t be any other “normal” level attributes set.

knife exec -E “nodes.transform(:all) {|n| n.normal.delete(‘chef_client’) }”

COOK-3276 isn’t in the current version, only on the master branch, but this will be in an upcoming release of the cookbook.

Cheers,
Joshua