-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/35519/
-----------------------------------------------------------

Review request for Ambari, Jonathan Hurley and Tom Beerbower.


Bugs: AMBARI-11950
    https://issues.apache.org/jira/browse/AMBARI-11950


Repository: ambari


Description
-------

The following call fails with java.lang.IllegalArgumentException: Invalid 
arguments, invalid desired state, desiredState=INSTALL_FAILED

PUT /api/v1/clusters/c1/host_components?HostRoles=state/INSTALL_FAILED
{
  "HostRoles": {
    "state": "INSTALLED"
  }
}

Updating host components' state happens in two steps.  The first step is to 
query the list of host components to select, then with that list, apply the 
state change.  The issue is that the resolution of request properties made the 
call act as though it was SETTING state=INSTALL_FAILED (which is invalid).

The fix was to resolve the request properties as a regular query (GET) 
operation, THEN set the desired state for update on the results (no change to 
that logic).


Diffs
-----

  
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
 40e3d5f 

Diff: https://reviews.apache.org/r/35519/diff/


Testing
-------

Existing unit tests cover functionality (that is, they all still functioned 
correctly).

Manual testing forced a failure in, say, 2 DN on install, then invoke the call 
above.

Tests run: 2961, Failures: 0, Errors: 0, Skipped: 21

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34:52 min
[INFO] Finished at: 2015-06-16T10:54:46-04:00
[INFO] Final Memory: 33M/1315M
[INFO] ------------------------------------------------------------------------


Thanks,

Nate Cole

Reply via email to