You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Ignasi Barrera (JIRA)" <ji...@apache.org> on 2013/10/04 09:46:41 UTC

[jira] [Assigned] (JCLOUDS-335) ChefApi.deleteDatabagItem fails with stack trace.

     [ https://issues.apache.org/jira/browse/JCLOUDS-335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ignasi Barrera reassigned JCLOUDS-335:
--------------------------------------

    Assignee: Ignasi Barrera

> ChefApi.deleteDatabagItem fails with stack trace.
> -------------------------------------------------
>
>                 Key: JCLOUDS-335
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-335
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-chef
>    Affects Versions: 1.7.0
>            Reporter: Noorul Islam K M
>            Assignee: Ignasi Barrera
>              Labels: bug
>
> E-mail from Alex Tang
> mChefContext.getApi().deleteDatabagItem(DATABAG_NAME, databagItemName);
> throws the following exception.  Any insight why?  The databag item was
> delete propertly.
> Thanks,
> Alex
> SEVERE: Error parsing input
> com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
> databag item must be a json hash ex. {"id":"item1","my_key":"my_data"}; was
> {"name":"data_bag_item_cisco_packages_N3000-node1","json_class":"Chef::DataBagItem","chef_type":"data_bag_item","data_bag":"cisco_packages","raw_data":{"id":"N3000-node1","created_by":"alextang","packages":[{"action":"add","image":"n3000-uk9.6.0.2.U1.1.CSCuf08335.bin"},{"action":"add","image":"n3000-uk9.6.0.2.U1.1.CSCuf23555.bin"},{"action":"add","image":"n3000-uk9.6.0.2.U1.1.CSCuf42365.bin"}],"location":"
> ftp://10.2.3.4","creation_time":"Thursday, October 3, 2013 2:39:00 PM PDT"}}
>     at com.google.gson.Gson.fromJson(Gson.java:802)
>     at com.google.gson.Gson.fromJson(Gson.java:757)
>     at com.google.gson.Gson.fromJson(Gson.java:706)
>     at org.jclouds.json.internal.GsonWrapper.fromJson(GsonWrapper.java:47)
>     at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:86)
>     at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:80)
>     at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:66)
>     at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:46)
>     at com.google.common.util.concurrent.Futures$3.apply(Futures.java:376)
>     at
> com.google.common.util.concurrent.Futures$ChainingListenableFuture.run(Futures.java:518)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     at java.lang.Thread.run(Thread.java:662)
> Caused by: java.lang.IllegalStateException: databag item must be a json
> hash ex. {"id":"item1","my_key":"my_data"}; was
> {"name":"data_bag_item_cisco_packages_N3000-node1","json_class":"Chef::DataBagItem","chef_type":"data_bag_item","data_bag":"cisco_packages","raw_data":{"id":"N3000-node1","created_by":"alextang","packages":[{"action":"add","image":"n3000-uk9.6.0.2.U1.1.CSCuf08335.bin"},{"action":"add","image":"n3000-uk9.6.0.2.U1.1.CSCuf23555.bin"},{"action":"add","image":"n3000-uk9.6.0.2.U1.1.CSCuf42365.bin"}],"location":"
> ftp://10.2.3.4","creation_time":"Thursday, October 3, 2013 2:39:00 PM PDT"}}
>     at
> com.google.common.base.Preconditions.checkState(Preconditions.java:176)
>     at
> org.jclouds.chef.config.ChefParserModule$DataBagItemAdapter.createJsonLiteralFromRawJson(ChefParserModule.java:182)
>     at
> org.jclouds.chef.config.ChefParserModule$DataBagItemAdapter.createJsonLiteralFromRawJson(ChefParserModule.java:176)
>     at
> org.jclouds.json.internal.NullHackJsonLiteralAdapter.read(NullHackJsonLiteralAdapter.java:44)
>     at com.google.gson.Gson.fromJson(Gson.java:791)
>     ... 12 more
> Here is the re-creation snippet (groovy)
> api.deleteDatabag("test")
> Gson gson = new Gson()
> api.createDatabag("test")
> Properties config = new Properties()
> config.setProperty("foo", "bar");
> def databagItem = api.createDatabagItem("test", new DatabagItem("config", gson.toJson(config)))
> def databagItemId = databagItem.getId()
> assertEquals(databagItem.getId(), "config");
> databagItem = api.getDatabagItem("test", databagItemId)
> assertEquals(databagItem.getId(), "config");
> databagItem = api.deleteDatabagItem("test", databagItemId)
> assertEquals(databagItem.getId(), "config");
> databagItem = api.getDatabagItem("test", databagItemId)
> assertNull(databagItem)
> Unfortunately we do not have a live test for this.



--
This message was sent by Atlassian JIRA
(v6.1#6144)