A question about override_attributes

All,

When I type out knife environment edit staging, I get a json file that I can edit. This is great, I love it. Unfortunately I’d like to be able to edit some override_attributes on a per node basis, and it seems override_attributes doesn’t work when I do knife node edit node1. Any advice? If I needed a per node override, any suggestions?

Thanks in advance!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

I believe when you edit a node you want to set the precedence to be
"normal" level attribute which is above the default attribute level.

I don't believe override attributes can be edited in the node data.

On Tue, May 28, 2013 at 11:31 AM, JJ Asghar jj.asghar@peopleadmin.comwrote:

All,

When I type out knife environment edit staging, I get a json file that I
can edit. This is great, I love it. Unfortunately I'd like to be able to
edit some override_attributes on a per node basis, and it
seems override_attributes doesn't work when I do knife node edit node1.
Any advice? If I needed a per node override, any suggestions?

Thanks in advance!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

It looks like this can work:
Node Attributes

Finally, the node object can be modified directly to set the attributes. Typically, this sets attributes at the normal priority level, and can be done by editing the node with knife or through the WebUI, or by passing JSON data to the node.

Does anyone have an example on this?

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: Pete Cheslock <petecheslock@gmail.commailto:petecheslock@gmail.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Tuesday, May 28, 2013 10:40 AM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: A question about override_attributes

I believe when you edit a node you want to set the precedence to be “normal” level attribute which is above the default attribute level.

I don’t believe override attributes can be edited in the node data.

On Tue, May 28, 2013 at 11:31 AM, JJ Asghar <jj.asghar@peopleadmin.commailto:jj.asghar@peopleadmin.com> wrote:
All,

When I type out knife environment edit staging, I get a json file that I can edit. This is great, I love it. Unfortunately I’d like to be able to edit some override_attributes on a per node basis, and it seems override_attributes doesn’t work when I do knife node edit node1. Any advice? If I needed a per node override, any suggestions?

Thanks in advance!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.commailto:jj.asghar@peopleadmin.com | c: 512.619.0722tel:512.619.0722 | o: 512.977.5876tel:512.977.5876

Opps, sorry I should make this clear. Any examples on the json version, .rb’s are here: http://wiki.opscode.com/pages/viewpage.action?pageId=13173073

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: JJ Asghar <jj.asghar@peopleadmin.commailto:jj.asghar@peopleadmin.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Tuesday, May 28, 2013 10:48 AM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: Re: A question about override_attributes

It looks like this can work:
Node Attributes

Finally, the node object can be modified directly to set the attributes. Typically, this sets attributes at the normal priority level, and can be done by editing the node with knife or through the WebUI, or by passing JSON data to the node.

Does anyone have an example on this?

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.commailto:jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: Pete Cheslock <petecheslock@gmail.commailto:petecheslock@gmail.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Tuesday, May 28, 2013 10:40 AM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: A question about override_attributes

I believe when you edit a node you want to set the precedence to be “normal” level attribute which is above the default attribute level.

I don’t believe override attributes can be edited in the node data.

On Tue, May 28, 2013 at 11:31 AM, JJ Asghar <jj.asghar@peopleadmin.commailto:jj.asghar@peopleadmin.com> wrote:
All,

When I type out knife environment edit staging, I get a json file that I can edit. This is great, I love it. Unfortunately I’d like to be able to edit some override_attributes on a per node basis, and it seems override_attributes doesn’t work when I do knife node edit node1. Any advice? If I needed a per node override, any suggestions?

Thanks in advance!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.commailto:jj.asghar@peopleadmin.com | c: 512.619.0722tel:512.619.0722 | o: 512.977.5876tel:512.977.5876

On Tuesday, May 28, 2013 at 8:48 AM, JJ Asghar wrote:

It looks like this can work:

(snip)

I believe when you edit a node you want to set the precedence to be "normal" level attribute which is above the default attribute level.

I don't believe override attributes can be edited in the node data.
This is correct, you cannot meaningfully edit override attributes per-node. Default and override attributes are designed to belong to cookbooks/roles/environments, so they are cleared by chef-client at the beginning of each chef-client run. This ensures that attributes you've removed from cookbooks/roles/environments are also deleted from clients.

Generally, it's better to define attributes on roles (or "role cookbooks" if you're into that) instead of munging the node data to make a snowflake node. This makes it clear why one particular node has a different behavior than others with the same cookbook(s).

--
Daniel DeLeo

Very good point - normally you don't want to edit the node and override via
there, much better via a recipe.

But if you did - it would look something like this (from the link you
posted).

On Tue, May 28, 2013 at 11:54 AM, Daniel DeLeo dan@kallistec.com wrote:

On Tuesday, May 28, 2013 at 8:48 AM, JJ Asghar wrote:

It looks like this can work:

(snip)

I believe when you edit a node you want to set the precedence to be
"normal" level attribute which is above the default attribute level.

I don't believe override attributes can be edited in the node data.

This is correct, you cannot meaningfully edit override attributes
per-node. Default and override attributes are designed to belong to
cookbooks/roles/environments, so they are cleared by chef-client at the
beginning of each chef-client run. This ensures that attributes you've
removed from cookbooks/roles/environments are also deleted from clients.

Generally, it's better to define attributes on roles (or "role cookbooks"
if you're into that) instead of munging the node data to make a snowflake
node. This makes it clear why one particular node has a different behavior
than others with the same cookbook(s).

--
Daniel DeLeo

Perfect thanks!

Best Regards,
JJ Asghar
e: jj.asghar@peopleadmin.com | c: 512.619.0722 | o: 512.977.5876

From: Pete Cheslock <petecheslock@gmail.commailto:petecheslock@gmail.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Tuesday, May 28, 2013 10:58 AM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: Re: Re: Re: A question about override_attributes

Very good point - normally you don’t want to edit the node and override via there, much better via a recipe.

But if you did - it would look something like this (from the link you posted).

On Tue, May 28, 2013 at 11:54 AM, Daniel DeLeo <dan@kallistec.commailto:dan@kallistec.com> wrote:

On Tuesday, May 28, 2013 at 8:48 AM, JJ Asghar wrote:

It looks like this can work:
(snip)

I believe when you edit a node you want to set the precedence to be “normal” level attribute which is above the default attribute level.

I don’t believe override attributes can be edited in the node data.
This is correct, you cannot meaningfully edit override attributes per-node. Default and override attributes are designed to belong to cookbooks/roles/environments, so they are cleared by chef-client at the beginning of each chef-client run. This ensures that attributes you’ve removed from cookbooks/roles/environments are also deleted from clients.

Generally, it’s better to define attributes on roles (or “role cookbooks” if you’re into that) instead of munging the node data to make a snowflake node. This makes it clear why one particular node has a different behavior than others with the same cookbook(s).


Daniel DeLeo