# Deleting Node attributes using Knife

**URL:** <https://discourse.chef.io/t/deleting-node-attributes-using-knife/5267>\
**Category:** Chef Infra (archive)\
**Created:** [April 3, 2014, 8:24pm UTC](https://discourse.chef.io/t/deleting-node-attributes-using-knife/5267 "2014-04-03T20:24:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kapil\_Shardha1](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@Kapil\_Shardha1](https://discourse.chef.io/u/Kapil_Shardha1)\
**Post date:** [April 3, 2014, 8:24pm UTC](https://discourse.chef.io/t/deleting-node-attributes-using-knife/5267/1 "2014-04-03T20:24:21Z")

</div>

I am trying to delete node attribute using knife, as mentioned in [http://docs.opscode.com/essentials\_cookbook\_resources\_first\_run.html](http://docs.opscode.com/essentials_cookbook_resources_first_run.html) (towards the end). The commands completes without any errors but I can still see the attribute in Chef Server UI. The same issue is mentioned at [http://stackoverflow.com/questions/20624221/not-able-to-delete-node-attribute-using-knife-command](http://stackoverflow.com/questions/20624221/not-able-to-delete-node-attribute-using-knife-command).

I ran the same command with -VV switch to get verbose output and I see HTTP 200 OK debug messages. The “knife search node ‘’” returns the correct node.

Any idea if it is a bug?

Thanks

-Kapil

* * *

This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.

---

<div class="post-metadata">

**Author:** ![Kapil\_Shardha1](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@Kapil\_Shardha1](https://discourse.chef.io/u/Kapil_Shardha1)\
**Post date:** [April 3, 2014, 8:41pm UTC](https://discourse.chef.io/t/deleting-node-attributes-using-knife/5267/2 "2014-04-03T20:41:32Z")

</div>

The workaround I have been using is to use "knife node edit " and manually delete the attributes. This is acceptable to me for now but would appreciate if I can get more insight on why the knife command mentioned in original post does not work.

Thanks

-Kapil

From: Kapil Shardha [[mailto:Kapil.Shardha@SimulationIQ.com](mailto:Kapil.Shardha@SimulationIQ.com)]  
Sent: Thursday, April 3, 2014 4:24 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Deleting Node attributes using Knife

I am trying to delete node attribute using knife, as mentioned in [http://docs.opscode.com/essentials\_cookbook\_resources\_first\_run.html](http://docs.opscode.com/essentials_cookbook_resources_first_run.html) (towards the end). The commands completes without any errors but I can still see the attribute in Chef Server UI. The same issue is mentioned at [http://stackoverflow.com/questions/20624221/not-able-to-delete-node-attribute-using-knife-command](http://stackoverflow.com/questions/20624221/not-able-to-delete-node-attribute-using-knife-command).

I ran the same command with -VV switch to get verbose output and I see HTTP 200 OK debug messages. The “knife search node ‘’” returns the correct node.

Any idea if it is a bug?

Thanks

-Kapil

* * *

This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.

* * *

This email and any accompanying documents may contain privileged or otherwise confidential information of, and/or is the property of Education Management Solutions, Inc. If you are not the intended recipient, please immediately advise the sender by reply email & delete the message & any attachments without using, copying or disclosing the contents. Thank you.

---

<div class="post-metadata">

**Author:** ![Steven\_Danna](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/steven_danna/32/195_2.png) [@Steven\_Danna](https://discourse.chef.io/u/Steven_Danna)\
**Post date:** [April 6, 2014, 7:57pm UTC](https://discourse.chef.io/t/deleting-node-attributes-using-knife/5267/3 "2014-04-06T19:57:14Z")

</div>

On 4/3/14, 1:41 PM, Kapil Shardha wrote:

> The workaround I have been using is to use “knife node edit ”  
> and manually delete the attributes. This is acceptable to me for now but  
> would appreciate if I can get more insight on why the knife command  
> mentioned in original post does not work.

I'll have to dig in a bit to see where it broke, but it definitely looks  
like the #delete method no longer works as documented on that page.  
However, if you know the level you set the attribute at, you can still  
delete it directly:

[1] pry(main)\> require 'chef'  
=\> true  
[2] pry(main)\> n = Chef::Node.new  
=\> node  
[2] pry(main)\> n.default['foo'] = 'bar'  
=\> "bar"  
[3] pry(main)\> n['foo']  
=\> "bar"  
[4] pry(main)\> n.delete('foo')  
=\> nil  
[5] pry(main)\> n['foo']  
=\> "bar"  
[6] pry(main)\> n.default.delete('foo')  
=\> "bar"  
[7] pry(main)\> n['foo']  
=\> nil

My guess is that this changed with the new Chef 11 attribute work that  
was done. But, even if it is intentional we should get

```
http://docs.opscode.com/breaking_changes_chef_11.html

```

and any other documentation that refers to it update.

Cheers,

Steven

--  
Steven Danna  
Systems Engineer, Chef, Inc  
GPG Key: [https://stevendanna.github.com/downloads/code/public.key](https://stevendanna.github.com/downloads/code/public.key)

---

<div class="post-metadata">

**Author:** ![Steven\_Danna](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/steven_danna/32/195_2.png) [@Steven\_Danna](https://discourse.chef.io/u/Steven_Danna)\
**Post date:** [April 6, 2014, 8:31pm UTC](https://discourse.chef.io/t/deleting-node-attributes-using-knife/5267/4 "2014-04-06T20:31:09Z")

</div>

Hi,

I’ve filed this here:

[https://tickets.opscode.com/browse/CHEF-5188](https://tickets.opscode.com/browse/CHEF-5188)

Cheers,

Steven

–  
Steven Danna  
Systems Engineer, Chef, Inc  
GPG Key: [https://stevendanna.github.com/downloads/code/public.key](https://stevendanna.github.com/downloads/code/public.key)
