Deleting Node attributes using Knife


#1

I am trying to delete node attribute using knife, as mentioned in 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.

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.


#2

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]
Sent: Thursday, April 3, 2014 4:24 PM
To: 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 (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.

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.


#3

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


#4

Hi,

I’ve filed this here:

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