You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Alex Tang <2d...@gmail.com> on 2013/10/04 00:13:53 UTC

Fwd: Two questions regarding JCloud-Chef

Hi

1)  It seems that the Chef server URL supplied to JCloud-Chef must be a
domain name, not IP address.  Is it possible to supply an IP address?

2) This method,

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

Re: Fwd: Two questions regarding JCloud-Chef

Posted by Noorul Islam K M <no...@noorul.com>.
Ignasi <ig...@gmail.com> writes:

> Alex, the issue has already been fixed and the latest snapshots have
> been uploaded to the snapshot repository. If you try again with the
> last version you should see it fixed.
>
>
> Thanks Noorul for the help!
>

You are welcome!

Thanks and Regards
Noorul

> On 4 October 2013 09:40, Ignasi <ig...@gmail.com> wrote:
>> Regarding question 1, at least until Chef 10 you could use an IP
>> address, but since Chef 11 there are some requirements for the
>> hostname [1]. It has to be resolvable and properly configured. If the
>> installation does not meet those requirements you may not expect it to
>> work.
>>
>>
>> [1] http://docs.opscode.com/install_server.html
>>
>>
>> On 4 October 2013 08:37, Andrew Phillips <ap...@qrmedia.com> wrote:
>>>>> Created a JIRA artifact
>>>>> https://issues.apache.org/jira/browse/JCLOUDS-335 to track this.
>>>>
>>>>
>>>> Also e-mailed chef-dev mailing list.
>>>>
>>>> http://lists.opscode.com/sympa/arc/chef-dev/2013-10/msg00043.html
>>>
>>>
>>> Thanks, Noorul!
>>>
>>> ap

Re: Fwd: Two questions regarding JCloud-Chef

Posted by Ignasi <ig...@gmail.com>.
Alex, the issue has already been fixed and the latest snapshots have
been uploaded to the snapshot repository. If you try again with the
last version you should see it fixed.


Thanks Noorul for the help!

On 4 October 2013 09:40, Ignasi <ig...@gmail.com> wrote:
> Regarding question 1, at least until Chef 10 you could use an IP
> address, but since Chef 11 there are some requirements for the
> hostname [1]. It has to be resolvable and properly configured. If the
> installation does not meet those requirements you may not expect it to
> work.
>
>
> [1] http://docs.opscode.com/install_server.html
>
>
> On 4 October 2013 08:37, Andrew Phillips <ap...@qrmedia.com> wrote:
>>>> Created a JIRA artifact
>>>> https://issues.apache.org/jira/browse/JCLOUDS-335 to track this.
>>>
>>>
>>> Also e-mailed chef-dev mailing list.
>>>
>>> http://lists.opscode.com/sympa/arc/chef-dev/2013-10/msg00043.html
>>
>>
>> Thanks, Noorul!
>>
>> ap

Re: Fwd: Two questions regarding JCloud-Chef

Posted by Ignasi <ig...@gmail.com>.
Regarding question 1, at least until Chef 10 you could use an IP
address, but since Chef 11 there are some requirements for the
hostname [1]. It has to be resolvable and properly configured. If the
installation does not meet those requirements you may not expect it to
work.


[1] http://docs.opscode.com/install_server.html


On 4 October 2013 08:37, Andrew Phillips <ap...@qrmedia.com> wrote:
>>> Created a JIRA artifact
>>> https://issues.apache.org/jira/browse/JCLOUDS-335 to track this.
>>
>>
>> Also e-mailed chef-dev mailing list.
>>
>> http://lists.opscode.com/sympa/arc/chef-dev/2013-10/msg00043.html
>
>
> Thanks, Noorul!
>
> ap

Re: Fwd: Two questions regarding JCloud-Chef

Posted by Andrew Phillips <ap...@qrmedia.com>.
>> Created a JIRA artifact
>> https://issues.apache.org/jira/browse/JCLOUDS-335 to track this.
>
> Also e-mailed chef-dev mailing list.
>
> http://lists.opscode.com/sympa/arc/chef-dev/2013-10/msg00043.html

Thanks, Noorul!

ap

Re: Fwd: Two questions regarding JCloud-Chef

Posted by Noorul Islam Kamal Malmiyoda <no...@noorul.com>.
On Fri, Oct 4, 2013 at 8:29 AM, Noorul Islam K M <no...@noorul.com> wrote:
> Alex Tang <2d...@gmail.com> writes:
>
>> Hi
>>
>> 1)  It seems that the Chef server URL supplied to JCloud-Chef must be a
>> domain name, not IP address.  Is it possible to supply an IP address?
>>
>
> Otherwise SSL handshake will not work out of the box.
>
>> 2) This method,
>>
>> mChefContext.getApi().deleteDatabagItem(DATABAG_NAME, databagItemName);
>>
>
> I think I could re-create this using a test recipe (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)
>
> And it is evident that, chef server output for delete is not the same as
> documented here http://docs.opscode.com/api_chef_server.html#id11
>
> See below the actual response.
>
>  noman in ~/projects/cu097-chef-repo
> G |master X| --> knife raw --method DELETE /data/test/config
> {"name":"data_bag_item_test_config","json_class":"Chef::DataBagItem","chef_type":"data_bag_item","data_bag":"test","raw_data":{"id":"config",
> "foo":"bar"}}
>
> Created a JIRA artifact
> https://issues.apache.org/jira/browse/JCLOUDS-335 to track this.
>
>

Also e-mailed chef-dev mailing list.

http://lists.opscode.com/sympa/arc/chef-dev/2013-10/msg00043.html

Thanks and Regards
Noorul

Re: Fwd: Two questions regarding JCloud-Chef

Posted by Noorul Islam K M <no...@noorul.com>.
Alex Tang <2d...@gmail.com> writes:

> Hi
>
> 1)  It seems that the Chef server URL supplied to JCloud-Chef must be a
> domain name, not IP address.  Is it possible to supply an IP address?
>

Otherwise SSL handshake will not work out of the box.

> 2) This method,
>
> mChefContext.getApi().deleteDatabagItem(DATABAG_NAME, databagItemName);
>

I think I could re-create this using a test recipe (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)

And it is evident that, chef server output for delete is not the same as
documented here http://docs.opscode.com/api_chef_server.html#id11

See below the actual response.

 noman in ~/projects/cu097-chef-repo
G |master X| --> knife raw --method DELETE /data/test/config
{"name":"data_bag_item_test_config","json_class":"Chef::DataBagItem","chef_type":"data_bag_item","data_bag":"test","raw_data":{"id":"config",
"foo":"bar"}}   

Created a JIRA artifact
https://issues.apache.org/jira/browse/JCLOUDS-335 to track this.


Thanks and Regards
Noorul

> 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