jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCLOUDS-335) ChefApi.deleteDatabagItem fails with stack trace.
Date Fri, 04 Oct 2013 09:47:45 GMT

    [ https://issues.apache.org/jira/browse/JCLOUDS-335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13786031#comment-13786031
] 

ASF subversion and git services commented on JCLOUDS-335:
---------------------------------------------------------

Commit 7eddead37b3eb9503cfd2aa2eef83ef41c0b71e0 in branch refs/heads/master from [~nacx]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-jclouds-chef.git;h=7eddead ]

JCLOUDS-335: Properly deserialize the deleteDatabagItem response


> 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
>             Fix For: 1.7.0
>
>
> 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)

Mime
View raw message