# Changing a node attribute from another node

**URL:** <https://discourse.chef.io/t/changing-a-node-attribute-from-another-node/1492>\
**Category:** Chef Infra (archive)\
**Created:** [July 30, 2010, 9:14am UTC](https://discourse.chef.io/t/changing-a-node-attribute-from-another-node/1492 "2010-07-30T09:14:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Smirnov](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@Alexander\_Smirnov](https://discourse.chef.io/u/Alexander_Smirnov)\
**Post date:** [July 30, 2010, 9:14am UTC](https://discourse.chef.io/t/changing-a-node-attribute-from-another-node/1492/1 "2010-07-30T09:14:32Z")

</div>

Hi,

Is there a way to change an attribute of some node from recipe on another node?  
When I use the set method on node object obtained via search method it  
changes locally but doesn’t get saved in the DB.

Thanks!

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [August 2, 2010, 4:17pm UTC](https://discourse.chef.io/t/changing-a-node-attribute-from-another-node/1492/2 "2010-08-02T16:17:26Z")

</div>

Once you have the Node object, you need to call save on it:

node = search('query').first  
node["new\_attribute"] = "hello from another node"  
node.save

but in general nodes aren't permitted to modify other nodes. To make  
it work, you'd have to make that node's API client an admin, which  
isn't something to do lightly. Maybe you can tell us more about your  
use case to see if there's an easier way to get the outcome you want?

Dan DeLeo

On Fri, Jul 30, 2010 at 2:14 AM, Alexander Smirnov  
[smirnov.alexander@gmail.com](mailto:smirnov.alexander@gmail.com) wrote:

> Hi,
> 
> Is there a way to change an attribute of some node from recipe on another node?  
> When I use the set method on node object obtained via search method it  
> changes locally but doesn't get saved in the DB.
> 
> Thanks!
