# Find Attributes in the 'Expanded' Attributes

**URL:** <https://discourse.chef.io/t/find-attributes-in-the-expanded-attributes/2194>\
**Category:** Chef Infra (archive)\
**Created:** [November 2, 2011, 5:18pm UTC](https://discourse.chef.io/t/find-attributes-in-the-expanded-attributes/2194 "2011-11-02T17:18:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbaugher](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@bbaugher](https://discourse.chef.io/u/bbaugher)\
**Post date:** [November 2, 2011, 5:18pm UTC](https://discourse.chef.io/t/find-attributes-in-the-expanded-attributes/2194/1 "2011-11-02T17:18:54Z")

</div>

Hi, I have a cookbook that uses search within its recipes in order to describe  
a cluster. I am using a specific attribute (clusterID) to define the grouping  
(and their recipes as their specific units master/slave…). Adding this  
attribute to the node directly works fine and search finds it easily.

My problem is that if you were to use an environment or role and define the  
clusterID (makes sense if you were to assign this to many nodes), search will  
pick up the attribute only after the node has run chef-client.

I have even tried running the ‘knife index rebuild’ command and I still get  
nothing. Is there anyway to fix this?

---

<div class="post-metadata">

**Author:** ![Adam\_Jacob](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/adam_jacob/32/292_2.png) [@Adam\_Jacob](https://discourse.chef.io/u/Adam_Jacob)\
**Post date:** [November 2, 2011, 5:57pm UTC](https://discourse.chef.io/t/find-attributes-in-the-expanded-attributes/2194/2 "2011-11-02T17:57:18Z")

</div>

Nope - it's intended to work that way. Seaching for those attributes on a node will only find them when they have been successfully applied to the node - if they don't exist, it hasn't happened yet.

Adam

* * *

Opscode, Inc.  
Adam Jacob, Chief Product Officer  
T: (206) 619-7151 E: [adam@opscode.com](mailto:adam@opscode.com)

On Nov 2, 2011, at 10:18 AM, [bjbq4d@gmail.com](mailto:bjbq4d@gmail.com) [bjbq4d@gmail.com](mailto:bjbq4d@gmail.com) wrote:

> Hi, I have a cookbook that uses search within its recipes in order to describe  
> a cluster. I am using a specific attribute (clusterID) to define the grouping  
> (and their recipes as their specific units master/slave...). Adding this  
> attribute to the node directly works fine and search finds it easily.
> 
> My problem is that if you were to use an environment or role and define the  
> clusterID (makes sense if you were to assign this to many nodes), search will  
> pick up the attribute only after the node has run chef-client.
> 
> I have even tried running the 'knife index rebuild' command and I still get  
> nothing. Is there anyway to fix this?

---

<div class="post-metadata">

**Author:** ![Peter\_Norton](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Peter\_Norton](https://discourse.chef.io/u/Peter_Norton)\
**Post date:** [November 2, 2011, 8:10pm UTC](https://discourse.chef.io/t/find-attributes-in-the-expanded-attributes/2194/3 "2011-11-02T20:10:10Z")

</div>

bjbq4d (if that really is your name) try this:

[https://github.com/infochimps/cluster\_chef/tree/master/site-cookbooks/cluster\_service\_discovery](https://github.com/infochimps/cluster_chef/tree/master/site-cookbooks/cluster_service_discovery)

This gets used with knife and cluster\_chef. When you launch the  
cluster, the nodes are registered.

-Peter

On Wed, Nov 2, 2011 at 1:18 PM, [bjbq4d@gmail.com](mailto:bjbq4d@gmail.com) wrote:

> Hi, I have a cookbook that uses search within its recipes in order to describe  
> a cluster. I am using a specific attribute (clusterID) to define the grouping  
> (and their recipes as their specific units master/slave...). Adding this  
> attribute to the node directly works fine and search finds it easily.
> 
> My problem is that if you were to use an environment or role and define the  
> clusterID (makes sense if you were to assign this to many nodes), search will  
> pick up the attribute only after the node has run chef-client.
> 
> I have even tried running the 'knife index rebuild' command and I still get  
> nothing. Is there anyway to fix this?
