Documentation differ from actual behavior


#1

I am using Open Source Chef Server 11.

As per http://docs.opscode.com/api_chef_server.html#id11

for the following command

knife raw --method DELETE /data/test/config

I expected to get following response

{“id”:“config”, “foo”:“bar”}

But I get

{“name”:“data_bag_item_test_config”,“json_class”:“Chef::DataBagItem”,“chef_type”:“data_bag_item”,“data_bag”:“test”,“raw_data”:{“id”:“config”,
“foo”:“bar”}}

Thanks and Regards
Noorul


#2

Forgot to copy dev mailing list.

---------- Forwarded message ----------
From: Noorul Islam K M noorul@noorul.com
Date: Fri, Oct 4, 2013 at 9:32 AM
Subject: Documentation differ from actual behavior
To: chef@lists.opscode.com

I am using Open Source Chef Server 11.

As per http://docs.opscode.com/api_chef_server.html#id11

for the following command

knife raw --method DELETE /data/test/config

I expected to get following response

{“id”:“config”, “foo”:“bar”}

But I get

{“name”:“data_bag_item_test_config”,“json_class”:“Chef::DataBagItem”,“chef_type”:“data_bag_item”,“data_bag”:“test”,“raw_data”:{“id”:“config”,
“foo”:“bar”}}

Thanks and Regards
Noorul


#3

On Fri, Oct 4, 2013 at 9:34 AM, Noorul Islam Kamal Malmiyoda
noorul@noorul.com wrote:

Forgot to copy dev mailing list.

---------- Forwarded message ----------
From: Noorul Islam K M noorul@noorul.com
Date: Fri, Oct 4, 2013 at 9:32 AM
Subject: Documentation differ from actual behavior
To: chef@lists.opscode.com

I am using Open Source Chef Server 11.

As per http://docs.opscode.com/api_chef_server.html#id11

for the following command

knife raw --method DELETE /data/test/config

I expected to get following response

{“id”:“config”, “foo”:“bar”}

But I get

{“name”:“data_bag_item_test_config”,“json_class”:“Chef::DataBagItem”,“chef_type”:“data_bag_item”,“data_bag”:“test”,“raw_data”:{“id”:“config”,
“foo”:“bar”}}

If someone can confirm that this is a documentation issue, then I will fix it.

Thanks and Regards
Noorul


#4

Hi Noorul,

Sorry for the delay in response.

noorul@noorul.com writes:

On Fri, Oct 4, 2013 at 9:34 AM, Noorul Islam Kamal Malmiyoda
noorul@noorul.com wrote:

Forgot to copy dev mailing list.

---------- Forwarded message ----------
From: Noorul Islam K M noorul@noorul.com
Date: Fri, Oct 4, 2013 at 9:32 AM
Subject: Documentation differ from actual behavior
To: chef@lists.opscode.com

I am using Open Source Chef Server 11.

As per http://docs.opscode.com/api_chef_server.html#id11

for the following command

knife raw --method DELETE /data/test/config

I expected to get following response

{“id”:“config”, “foo”:“bar”}

But I get

{“name”:“data_bag_item_test_config”,“json_class”:“Chef::DataBagItem”,“chef_type”:“data_bag_item”,“data_bag”:“test”,“raw_data”:{“id”:“config”,
“foo”:“bar”}}

If someone can confirm that this is a documentation issue, then I will
fix it.

Yes, we should update the docs. In putting Chef Server 11 together, we
attempted to clean up some edge cases of the API, but had to make
compromises to keep the server backwards compatible with Chef 10 client
code.

You can create data bag items using the “simple” body like:

{“id”:“config”, “foo”:“bar”}

But when you use knife to create a data bag item, it will send what we
lovingly refer to as the “encrufted item” format to the server. Knife
expects the encrufted form for processing the DELETE and so at the last
minute we put that back. Certainly something to clean up for Chef Server
12.

Hope that helps in terms of providing some context/history. We’ll see
that the docs get updated (or would welcome a patch if you’d like).

Best,

  • seth


Seth Falcon | Development Lead | Opscode | @sfalcon