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

Andrew Onischuk commented on AMBARI-3079:
-----------------------------------------

There was a lot of confusement around these 2 funcs for me.
{code}
ModelList.to_json_dict
BaseModel.to_json_dict
{code}
And actually an error in the code caused by the same problem. The 
ModelList.to_json_dict was used for creating a request, but should be used for 
working with response, which caused a wrong request formed for create_host So I 
added a new func to parse requestfrom the ModelList

{code}
----------------------------------------------------------------------
Ran 5 tests in 0.014s

OK
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.893s
[INFO] Finished at: Mon Sep 02 08:15:57 PDT 2013
[INFO] Final Memory: 3M/161M
{code}
                
> Ambari-Client Create Hosts request doesn't follows api request format
> ---------------------------------------------------------------------
>
>                 Key: AMBARI-3079
>                 URL: https://issues.apache.org/jira/browse/AMBARI-3079
>             Project: Ambari
>          Issue Type: Task
>            Reporter: Andrew Onischuk
>            Assignee: Andrew Onischuk
>
> Here is the request which ambari-client sends now to add a host:
> {code}
> curl -i -X POST -d '{"items": [{"ip": "192.168.56.106", "host_name": 
> "dev06.hortonworks.com", "rack_info": null}]}' -u admin:admin 
> http://dev05.hortonworks.com:8080/api/v1/hosts
> {code}
> It does not get parsed successfuly by our api
> Here what we should send, and what successfully adds hosts:
> {code}
> curl -i -X POST -d '[{"Hosts":{"ip": 
> "192.168.56.106","host_name":"dev05.hortonworks.com","rack_info":"/default-rack"}},{"Hosts":{"host_name":"one_more_host"}}}]'
>  -u admin:admin http://dev05.hortonworks.com:8080/api/v1/hosts
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to