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

Sumit Mohanty commented on AMBARI-4782:
---------------------------------------

[~dmitriusan], we then have four combinations

* GET with predicate that uses "state=???"
This should map to the live-state as you said. I think it can be treated as a 
bug as it just makes sense to map it to live state.

* GET with predicate that uses "desired_state=???"
This should map to the desired_state. Its the behavior we already have.

* PUT with "state=???"
This has an issue. We do not allow live state to be writable via API. So we 
silently map it to desired_state. So the choices here are 1) throw an error or, 
2) keep the same behavior as we have now. I vote for keeping the same behavior 
as its in line with what the caller "really" desired.

* PUT with "desired_state=???"
We should allow this and the behavior should be same as above.

> Error in getting host components with state INSTALL_FAILED
> ----------------------------------------------------------
>
>                 Key: AMBARI-4782
>                 URL: https://issues.apache.org/jira/browse/AMBARI-4782
>             Project: Ambari
>          Issue Type: Task
>          Components: controller, test
>    Affects Versions: 1.3.0
>            Reporter: Dmitry Lysnichenko
>            Assignee: Dmitry Lysnichenko
>             Fix For: 1.5.0
>
>
> h2. The problem
> When try to get query on 
> api/v1/clusters/<clustername>/host_components?HostRoles/state=INSTALL_FAILED
> Response is
> { "status" : 400, "message" : "Invalid Request: Invalid arguments, invalid 
> desired state, desiredState=INSTALL_FAILED" }
> This issue is rooted at the over all issue Ambari has where when "state" is 
> specified in the API requests it is always interpreted as "desired_state". 
> And INSTALL_FAILED is an invalid "desired_state". Just fixing the GET calls 
> to interpret request:state as "state" (current state of a host component) 
> might be the right thing to do but will make the get calls to behave 
> differently than other calls. For example, request to set all component which 
> are in INSTALL_FAILED state to INIT (or MAINTENANCE) will not work as 
> expected. 
> h2. The proposal:
> The fix is to distinguish between "current_state" and "desired_state" and 
> promote "current_state" as a first class query parameter. "state" query 
> parameter will be still mapped to "desired_state" to maintain backward 
> compatibility.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to